Fix resume

This commit is contained in:
angelblue05 2018-01-27 03:16:24 -06:00
parent 4aba863c87
commit c54ed32328

View file

@ -85,9 +85,27 @@ class PlaybackUtils(object):
index = max(self.playlist.getposition(), 0) + 1 # Can return -1 index = max(self.playlist.getposition(), 0) + 1 # Can return -1
force_play = False force_play = False
''' Krypton 17.6 broke StartOffset. Seems to be working in Leia.
For now, set up using StartPercent.
TODO: Once Leia is fully supported, move back to StartOffset.
'''
seektime_percent = (seektime/self.API.get_runtime()) * 100
log.info("seektime detected (percent): %s", seektime_percent)
listitem.setProperty('StartPercent', str(seektime_percent))
# Stack: [(url, listitem), (url, ...), ...] # Stack: [(url, listitem), (url, ...), ...]
self.stack[0][1].setPath(self.stack[0][0]) self.stack[0][1].setPath(self.stack[0][0])
try: try:
if not xbmc.getCondVisibility('Window.IsMedia'):
log.debug("Window.IsMedia detected.")
if self.item['Type'] == "Audio" and not xbmc.getCondVisibility('Integer.IsGreater(Playlist.Length(music),1)'):
log.debug("Music playlist length detected.")
if not xbmc.getCondVisibility('Integer.IsGreater(Playlist.Length(video),1)'):
log.debug("Video playlist length detected.")
if (not xbmc.getCondVisibility('Window.IsMedia') and if (not xbmc.getCondVisibility('Window.IsMedia') and
((self.item['Type'] == "Audio" and not xbmc.getCondVisibility('Integer.IsGreater(Playlist.Length(music),1)')) or ((self.item['Type'] == "Audio" and not xbmc.getCondVisibility('Integer.IsGreater(Playlist.Length(music),1)')) or
not xbmc.getCondVisibility('Integer.IsGreater(Playlist.Length(video),1)'))): not xbmc.getCondVisibility('Integer.IsGreater(Playlist.Length(video),1)'))):
@ -100,7 +118,6 @@ class PlaybackUtils(object):
except IndexError: except IndexError:
log.info("Playback activated via the context menu or widgets.") log.info("Playback activated via the context menu or widgets.")
force_play = True force_play = True
listitem.setProperty('StartOffset', str(seektime))
for stack in self.stack: for stack in self.stack:
self.playlist.add(url=stack[0], listitem=stack[1], index=index) self.playlist.add(url=stack[0], listitem=stack[1], index=index)