Fix playback when the same video is started again from a widget

This commit is contained in:
croneter 2019-06-02 13:47:50 +02:00
parent 3ba09e1ff0
commit 6bd5b28e0c
2 changed files with 9 additions and 3 deletions

View file

@ -55,7 +55,10 @@ class PlayState(object):
# Set by SpecialMonitor - did user choose to resume playback or start from the # Set by SpecialMonitor - did user choose to resume playback or start from the
# beginning? # 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? # Was the playback initiated by the user using the Kodi context menu?
self.context_menu_play = False self.context_menu_play = False
# Set by context menu - shall we force-transcode the next playing item? # Set by context menu - shall we force-transcode the next playing item?

View file

@ -53,7 +53,7 @@ def playback_triage(plex_id=None, plex_type=None, path=None, resolve=True):
# playback # playback
app.PLAYSTATE.context_menu_play = False app.PLAYSTATE.context_menu_play = False
app.PLAYSTATE.force_transcode = 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): def _playback_triage(plex_id, plex_type, path, resolve):
@ -132,6 +132,9 @@ def _playback_triage(plex_id, plex_type, path, resolve):
initiate = True initiate = True
else: else:
initiate = False 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: if initiate:
_playback_init(plex_id, plex_type, playqueue, pos) _playback_init(plex_id, plex_type, playqueue, pos)
else: else:
@ -218,7 +221,7 @@ def _playback_init(plex_id, plex_type, playqueue, pos):
elif app.SYNC.direct_paths: elif app.SYNC.direct_paths:
resume = False resume = False
else: else:
resume = app.PLAYSTATE.resume_playback resume = app.PLAYSTATE.resume_playback or False
trailers = False trailers = False
if (not resume and plex_type == v.PLEX_TYPE_MOVIE and if (not resume and plex_type == v.PLEX_TYPE_MOVIE and
utils.settings('enableCinema') == "true"): utils.settings('enableCinema') == "true"):