Fix playback not resuming (Kodi 18 ignores listitem "StartOffset")
- Fixes #525
This commit is contained in:
parent
229a04e65b
commit
9a8fcbb8a5
1 changed files with 9 additions and 2 deletions
|
@ -411,6 +411,7 @@ def _conclude_playback(playqueue, pos):
|
||||||
playutils = PlayUtils(api, item)
|
playutils = PlayUtils(api, item)
|
||||||
playurl = playutils.getPlayUrl()
|
playurl = playutils.getPlayUrl()
|
||||||
else:
|
else:
|
||||||
|
api = None
|
||||||
playurl = item.file
|
playurl = item.file
|
||||||
listitem.setPath(utils.try_encode(playurl))
|
listitem.setPath(utils.try_encode(playurl))
|
||||||
if item.playmethod == 'DirectStream':
|
if item.playmethod == 'DirectStream':
|
||||||
|
@ -428,8 +429,14 @@ def _conclude_playback(playqueue, pos):
|
||||||
with kodidb.GetKodiDB('video') as kodi_db:
|
with kodidb.GetKodiDB('video') as kodi_db:
|
||||||
item.offset = kodi_db.get_resume(file_id)
|
item.offset = kodi_db.get_resume(file_id)
|
||||||
LOG.info('Resuming playback at %s', item.offset)
|
LOG.info('Resuming playback at %s', item.offset)
|
||||||
listitem.setProperty('StartOffset', str(item.offset))
|
if v.KODIVERSION >= 18 and api:
|
||||||
listitem.setProperty('resumetime', str(item.offset))
|
# Kodi 18 Alpha 3 broke StartOffset
|
||||||
|
percent = float(item.offset) / api.runtime() * 100.0
|
||||||
|
LOG.debug('Resuming at %s percent', percent)
|
||||||
|
listitem.setProperty('StartPercent', str(percent))
|
||||||
|
else:
|
||||||
|
listitem.setProperty('StartOffset', str(item.offset))
|
||||||
|
listitem.setProperty('resumetime', str(item.offset))
|
||||||
# Reset the resumable flag
|
# Reset the resumable flag
|
||||||
result.listitem = listitem
|
result.listitem = listitem
|
||||||
pickler.pickle_me(result)
|
pickler.pickle_me(result)
|
||||||
|
|
Loading…
Reference in a new issue