From 6bd5b28e0c8ca7cf51453031845e1e9c6596b24e Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 2 Jun 2019 13:47:50 +0200 Subject: [PATCH] Fix playback when the same video is started again from a widget --- resources/lib/app/playstate.py | 5 ++++- resources/lib/playback.py | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/resources/lib/app/playstate.py b/resources/lib/app/playstate.py index c99aeafa..0266c65d 100644 --- a/resources/lib/app/playstate.py +++ b/resources/lib/app/playstate.py @@ -55,7 +55,10 @@ class PlayState(object): # Set by SpecialMonitor - did user choose to resume playback or start from the # beginning? - self.resume_playback = False + # Set to None if resume dialog has not been shown + # True if dialog has been shown and user selected to resume + # False if dialog has been shown and user chose to start from beginning + 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/playback.py b/resources/lib/playback.py index 06b252c5..ed3ba188 100644 --- a/resources/lib/playback.py +++ b/resources/lib/playback.py @@ -53,7 +53,7 @@ def playback_triage(plex_id=None, plex_type=None, path=None, resolve=True): # playback app.PLAYSTATE.context_menu_play = False app.PLAYSTATE.force_transcode = False - app.PLAYSTATE.resume_playback = False + app.PLAYSTATE.resume_playback = None def _playback_triage(plex_id, plex_type, path, resolve): @@ -132,6 +132,9 @@ def _playback_triage(plex_id, plex_type, path, resolve): initiate = True else: initiate = False + if not initiate and app.PLAYSTATE.resume_playback is not None: + LOG.debug('Detected re-playing of the same item') + initiate = True if initiate: _playback_init(plex_id, plex_type, playqueue, pos) else: @@ -218,7 +221,7 @@ def _playback_init(plex_id, plex_type, playqueue, pos): elif app.SYNC.direct_paths: resume = False else: - resume = app.PLAYSTATE.resume_playback + resume = app.PLAYSTATE.resume_playback or False trailers = False if (not resume and plex_type == v.PLEX_TYPE_MOVIE and utils.settings('enableCinema') == "true"):