From 12befecc4aec3fdab0fd06ba0ac62cf37aacd245 Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 7 Apr 2019 13:18:15 +0200 Subject: [PATCH] Rewire video resume info --- resources/lib/app/playstate.py | 7 ++++--- resources/lib/kodimonitor.py | 6 +++--- resources/lib/playstrm.py | 5 ++--- resources/lib/windows/resume.py | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/resources/lib/app/playstate.py b/resources/lib/app/playstate.py index c99aeafa..3b9be12f 100644 --- a/resources/lib/app/playstate.py +++ b/resources/lib/app/playstate.py @@ -53,9 +53,10 @@ class PlayState(object): } self.played_info = {} - # Set by SpecialMonitor - did user choose to resume playback or start from the - # beginning? - self.resume_playback = False + # Set by SpecialMonitor - did user choose to resume playback or start + # from the beginning? + # Do set to None if NO resume dialog is displayed! True/False otherwise + self.resume_playback = None # Was the playback initiated by the user using the Kodi context menu? self.context_menu_play = False # Set by context menu - shall we force-transcode the next playing item? diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index 23243da7..8fde54b4 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -21,8 +21,8 @@ from . import backgroundthread, app, variables as v LOG = getLogger('PLEX.kodimonitor') # "Start from beginning", "Play from beginning" -STRINGS = (utils.try_encode(utils.lang(12021)), - utils.try_encode(utils.lang(12023))) +STRINGS = (utils.lang(12021).encode('utf-8'), + utils.lang(12023).encode('utf-8')) class KodiMonitor(xbmc.Monitor): @@ -559,5 +559,5 @@ class ContextMonitor(backgroundthread.KillableThread): app.PLAYSTATE.resume_playback = True if control == 1001 else False else: # Different context menu is displayed - app.PLAYSTATE.resume_playback = False + app.PLAYSTATE.resume_playback = None xbmc.sleep(100) diff --git a/resources/lib/playstrm.py b/resources/lib/playstrm.py index 08fa690d..e44093b6 100644 --- a/resources/lib/playstrm.py +++ b/resources/lib/playstrm.py @@ -206,9 +206,8 @@ class PlayStrm(object): Resume item if available. Returns bool or raise an PlayStrmException if resume was cancelled by user. ''' - seektime = utils.window('plex.resume') - utils.window('plex.resume', clear=True) - seektime = seektime == 'true' if seektime else None + seektime = app.PLAYSTATE.resume_playback + app.PLAYSTATE.resume_playback = None auto_play = utils.window('plex.autoplay.bool') if auto_play: seektime = False diff --git a/resources/lib/windows/resume.py b/resources/lib/windows/resume.py index 3f242646..a0d10db6 100644 --- a/resources/lib/windows/resume.py +++ b/resources/lib/windows/resume.py @@ -10,7 +10,7 @@ import xbmcaddon from logging import getLogger -LOG = getLogger('PLEX.resume') +LOG = getLogger('PLEX.windows.resume') XML_PATH = (xbmcaddon.Addon('plugin.video.plexkodiconnect').getAddonInfo('path'), "default",