Fix playback cleanup if PKC causes stop

This commit is contained in:
croneter 2018-02-07 13:57:07 +01:00
parent bdad905df3
commit 5ca0f7d6af
3 changed files with 8 additions and 1 deletions

View file

@ -68,6 +68,7 @@ def playback_triage(plex_id=None, plex_type=None, path=None, resolve=True):
except IndexError: except IndexError:
# Release our default.py before starting our own Kodi player instance # Release our default.py before starting our own Kodi player instance
if resolve is True: if resolve is True:
state.PKC_CAUSED_STOP = True
result = Playback_Successful() result = Playback_Successful()
result.listitem = PKC_ListItem(path='PKC_Dummy_Path_Which_Fails') result.listitem = PKC_ListItem(path='PKC_Dummy_Path_Which_Fails')
pickle_me(result) pickle_me(result)

View file

@ -82,7 +82,11 @@ class PKC_Player(Player):
Will be called when playback is stopped by the user Will be called when playback is stopped by the user
""" """
LOG.debug("ONPLAYBACK_STOPPED") 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): def onPlayBackEnded(self):
""" """

View file

@ -88,6 +88,8 @@ WEBSOCKET_QUEUE = None
# Which Kodi player is/has been active? (either int 1, 2 or 3) # Which Kodi player is/has been active? (either int 1, 2 or 3)
ACTIVE_PLAYERS = [] ACTIVE_PLAYERS = []
# Failsafe for throwing failing ListItems() back to Kodi's setResolvedUrl
PKC_CAUSED_STOP = False
# Kodi player states - here, initial values are set # Kodi player states - here, initial values are set
PLAYER_STATES = { PLAYER_STATES = {