Fix Plex Companion showing last item being played

This commit is contained in:
tomkat83 2017-01-09 21:25:52 +01:00
parent 0b304f563c
commit 03438b1c76

View file

@ -141,7 +141,8 @@ class Playqueue(Thread):
del old[j], index[j] del old[j], index[j]
break break
else: 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: if playqueue.ID is None:
PL.init_Plex_playlist(playqueue, PL.init_Plex_playlist(playqueue,
kodi_item=new_item) kodi_item=new_item)
@ -149,6 +150,9 @@ class Playqueue(Thread):
PL.add_item_to_PMS_playlist(playqueue, PL.add_item_to_PMS_playlist(playqueue,
i, i,
kodi_item=new_item) kodi_item=new_item)
index.insert(i, i)
for j in range(i+1, len(index)):
index[j] += 1
for i in reversed(index): for i in reversed(index):
log.debug('Detected deletion of playqueue element at pos %s' % i) log.debug('Detected deletion of playqueue element at pos %s' % i)
PL.delete_playlist_item_from_PMS(playqueue, i) PL.delete_playlist_item_from_PMS(playqueue, i)