From 0ce29dc0ce22a348992e0bf5f3ed3c0130b65642 Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 19 May 2019 18:47:09 +0200 Subject: [PATCH] Fix Plex Companion telling the wrong item is playing --- resources/lib/playlist_func.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/resources/lib/playlist_func.py b/resources/lib/playlist_func.py index 48442e32..761c151e 100644 --- a/resources/lib/playlist_func.py +++ b/resources/lib/playlist_func.py @@ -180,7 +180,10 @@ class PlayQueue(object): plex_id, self.items[startpos]) api = API(xml[0]) resume = self._resume_playback(None, xml[0]) - self._kodi_add_xml(xml[0], api, resume) + self._kodi_add_xml(xml[0], + api, + resume, + playlistitem=self.items[startpos]) # Add additional file parts, if any exist self._add_additional_parts(xml) @@ -303,8 +306,9 @@ class PlayQueue(object): LOG.debug('Adding addional part for %s: %s', api.title(), part) self._kodi_add_xml(xml[0], api) - def _kodi_add_xml(self, xml, api, resume=False): - playlistitem = PlaylistItem(xml_video_element=xml) + def _kodi_add_xml(self, xml, api, resume=False, playlistitem=None): + if not playlistitem: + playlistitem = PlaylistItem(xml_video_element=xml) playlistitem.part = api.part playlistitem.force_transcode = self.force_transcode listitem = widgets.get_listitem(xml, resume=True)