From 5ca0f7d6afbeedd130c64050d417572e923cb109 Mon Sep 17 00:00:00 2001 From: croneter Date: Wed, 7 Feb 2018 13:57:07 +0100 Subject: [PATCH] Fix playback cleanup if PKC causes stop --- resources/lib/playback.py | 1 + resources/lib/player.py | 6 +++++- resources/lib/state.py | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/lib/playback.py b/resources/lib/playback.py index da9d8b9a..68f223dd 100644 --- a/resources/lib/playback.py +++ b/resources/lib/playback.py @@ -68,6 +68,7 @@ def playback_triage(plex_id=None, plex_type=None, path=None, resolve=True): except IndexError: # Release our default.py before starting our own Kodi player instance if resolve is True: + state.PKC_CAUSED_STOP = True result = Playback_Successful() result.listitem = PKC_ListItem(path='PKC_Dummy_Path_Which_Fails') pickle_me(result) diff --git a/resources/lib/player.py b/resources/lib/player.py index 29d4b660..64710f66 100644 --- a/resources/lib/player.py +++ b/resources/lib/player.py @@ -82,7 +82,11 @@ class PKC_Player(Player): Will be called when playback is stopped by the user """ LOG.debug("ONPLAYBACK_STOPPED") - playback_cleanup() + if state.PKC_CAUSED_STOP is True: + state.PKC_CAUSED_STOP = False + LOG.debug('PKC caused this playback stop - ignoring') + else: + playback_cleanup() def onPlayBackEnded(self): """ diff --git a/resources/lib/state.py b/resources/lib/state.py index 9e371232..0f7b20f4 100644 --- a/resources/lib/state.py +++ b/resources/lib/state.py @@ -88,6 +88,8 @@ WEBSOCKET_QUEUE = None # Which Kodi player is/has been active? (either int 1, 2 or 3) ACTIVE_PLAYERS = [] +# Failsafe for throwing failing ListItems() back to Kodi's setResolvedUrl +PKC_CAUSED_STOP = False # Kodi player states - here, initial values are set PLAYER_STATES = {