From 16e5dbe4797540da18cd456a42a419886e4c051d Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Sat, 27 Jan 2018 04:26:59 -0600 Subject: [PATCH] Fix resume --- resources/lib/kodimonitor.py | 1 - resources/lib/playbackutils.py | 20 ++++++-------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index 1c034989..7d1a6dce 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -227,7 +227,6 @@ class SpecialMonitor(threading.Thread): isPlaying = player.isPlaying() if (not isPlaying and xbmc.getCondVisibility('Window.IsVisible(DialogContextMenu.xml)') and - not xbmc.getCondVisibility('Window.IsVisible(MyVideoNav.xml)') and xbmc.getInfoLabel('Control.GetLabel(1002)') == xbmc.getLocalizedString(12021)): control = int(xbmcgui.Window(10106).getFocusId()) diff --git a/resources/lib/playbackutils.py b/resources/lib/playbackutils.py index e4dc7d1e..7b13dc71 100644 --- a/resources/lib/playbackutils.py +++ b/resources/lib/playbackutils.py @@ -86,26 +86,18 @@ class PlaybackUtils(object): force_play = False ''' Krypton 17.6 broke StartOffset. Seems to be working in Leia. - For now, set up using StartPercent. + For now, set up using StartPercent and adjust a bit to compensate. 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)) + if seektime: + seektime_percent = ((seektime/self.API.get_runtime()) * 100) - 0.40 + 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.") - + try: 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)'))):