From f8ed5646c5dc36922b4426673594a9f5e479719b Mon Sep 17 00:00:00 2001 From: croneter Date: Tue, 17 Apr 2018 21:01:51 +0200 Subject: [PATCH] Fix PKC playback startup getting caught in infinity loop --- resources/lib/kodimonitor.py | 2 +- resources/lib/playback.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index 2ae3a354..d5070df3 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -144,12 +144,12 @@ class KodiMonitor(xbmc.Monitor): if data.get('end'): if state.PKC_CAUSED_STOP is True: state.PKC_CAUSED_STOP = False - state.PKC_CAUSED_STOP_DONE = True LOG.debug('PKC caused this playback stop - ignoring') else: _playback_cleanup(ended=True) else: _playback_cleanup() + state.PKC_CAUSED_STOP_DONE = True state.SUSPEND_SYNC = False elif method == 'Playlist.OnAdd': self._playlist_onadd(data) diff --git a/resources/lib/playback.py b/resources/lib/playback.py index dc6e7b1b..fe7c9c1a 100644 --- a/resources/lib/playback.py +++ b/resources/lib/playback.py @@ -124,8 +124,12 @@ def _playback_init(plex_id, plex_type, playqueue, pos): LOG.debug('Playing trailers: %s', trailers) if RESOLVE: # Sleep a bit to let setResolvedUrl do its thing - bit ugly + sleep_timer = 0 while not state.PKC_CAUSED_STOP_DONE: sleep(50) + sleep_timer += 1 + if sleep_timer > 100: + break playqueue.clear() if plex_type != v.PLEX_TYPE_CLIP: # Post to the PMS to create a playqueue - in any case due to Companion