Fix Plex trailers screwing up playqueue

- Introduce a flag to check whether PKC itself made changes to the playqueue
This commit is contained in:
Croneter 2018-04-10 07:56:44 +02:00
parent e6199819c4
commit f6b3dfdf12
3 changed files with 8 additions and 0 deletions

View file

@ -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 <missing path>"
thread.start()
# Ensure that PKC playqueue monitor ignores the changes we just made
playqueue.pkc_edit = True
def _ensure_resolve(abort=False):

View file

@ -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 = []

View file

@ -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)