From f6b3dfdf12848b1edc4efc6117ca6ad5309b909d Mon Sep 17 00:00:00 2001 From: Croneter Date: Tue, 10 Apr 2018 07:56:44 +0200 Subject: [PATCH] Fix Plex trailers screwing up playqueue - Introduce a flag to check whether PKC itself made changes to the playqueue --- resources/lib/playback.py | 2 ++ resources/lib/playlist_func.py | 3 +++ resources/lib/playqueue.py | 3 +++ 3 files changed, 8 insertions(+) diff --git a/resources/lib/playback.py b/resources/lib/playback.py index 3dea359b..dc6e7b1b 100644 --- a/resources/lib/playback.py +++ b/resources/lib/playback.py @@ -165,6 +165,8 @@ def _playback_init(plex_id, plex_type, playqueue, pos): # plugin://pkc will be lost; Kodi will try to startup playback for an empty # path: log entry is "CGUIWindowVideoBase::OnPlayMedia " thread.start() + # Ensure that PKC playqueue monitor ignores the changes we just made + playqueue.pkc_edit = True def _ensure_resolve(abort=False): diff --git a/resources/lib/playlist_func.py b/resources/lib/playlist_func.py index 2ca38124..4e260958 100644 --- a/resources/lib/playlist_func.py +++ b/resources/lib/playlist_func.py @@ -49,6 +49,9 @@ class PlaylistObjectBaseclase(object): self.plex_transient_token = None # Need a hack for detecting swaps of elements self.old_kodi_pl = [] + # Did PKC itself just change the playqueue so the PKC playqueue monitor + # should not pick up any changes? + self.pkc_edit = False # Workaround to avoid endless loops of detecting PL clears self._clear_list = [] diff --git a/resources/lib/playqueue.py b/resources/lib/playqueue.py index e2634d9f..fd188bb3 100644 --- a/resources/lib/playqueue.py +++ b/resources/lib/playqueue.py @@ -234,6 +234,9 @@ class PlayqueueMonitor(Thread): # Only initialize if directly fired up using direct # paths. Otherwise let default.py do its magic LOG.debug('Not yet initiating playback') + elif playqueue.pkc_edit: + playqueue.pkc_edit = False + LOG.debug('PKC just edited the playqueue - skipping') else: # compare old and new playqueue self._compare_playqueues(playqueue, kodi_pl)