From 03438b1c7611ba52621f10f001215702daf6c442 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Mon, 9 Jan 2017 21:25:52 +0100 Subject: [PATCH] Fix Plex Companion showing last item being played --- resources/lib/playqueue.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/lib/playqueue.py b/resources/lib/playqueue.py index 2e1085b6..cf87218e 100644 --- a/resources/lib/playqueue.py +++ b/resources/lib/playqueue.py @@ -141,7 +141,8 @@ class Playqueue(Thread): del old[j], index[j] break else: - log.debug('Detected new Kodi element: %s' % new_item) + log.debug('Detected new Kodi element at position %s: %s ' + % (i, new_item)) if playqueue.ID is None: PL.init_Plex_playlist(playqueue, kodi_item=new_item) @@ -149,6 +150,9 @@ class Playqueue(Thread): PL.add_item_to_PMS_playlist(playqueue, i, kodi_item=new_item) + index.insert(i, i) + for j in range(i+1, len(index)): + index[j] += 1 for i in reversed(index): log.debug('Detected deletion of playqueue element at pos %s' % i) PL.delete_playlist_item_from_PMS(playqueue, i)