diff --git a/resources/lib/playbackutils.py b/resources/lib/playbackutils.py index 49040084..e4dc7d1e 100644 --- a/resources/lib/playbackutils.py +++ b/resources/lib/playbackutils.py @@ -85,9 +85,27 @@ class PlaybackUtils(object): index = max(self.playlist.getposition(), 0) + 1 # Can return -1 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, ...), ...] self.stack[0][1].setPath(self.stack[0][0]) 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 ((self.item['Type'] == "Audio" and not xbmc.getCondVisibility('Integer.IsGreater(Playlist.Length(music),1)')) or not xbmc.getCondVisibility('Integer.IsGreater(Playlist.Length(video),1)'))): @@ -100,7 +118,6 @@ class PlaybackUtils(object): except IndexError: log.info("Playback activated via the context menu or widgets.") force_play = True - listitem.setProperty('StartOffset', str(seektime)) for stack in self.stack: self.playlist.add(url=stack[0], listitem=stack[1], index=index)