From bee845ca95561f5a4a5d1b3237d1604b4f4c5cf3 Mon Sep 17 00:00:00 2001 From: croneter Date: Sat, 3 Feb 2018 15:12:10 +0100 Subject: [PATCH] Fix PKC clearing Kodi playlist --- resources/lib/kodimonitor.py | 2 +- resources/lib/playlist_func.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index b31f777b..26900e57 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -276,7 +276,7 @@ class KodiMonitor(Monitor): if playqueue.is_kodi_onclear() is False: LOG.debug('PKC already cleared the playqueue - ignoring') return - playqueue.clear() + playqueue.clear(kodi=False) def _get_ids(self, json_item): """ diff --git a/resources/lib/playlist_func.py b/resources/lib/playlist_func.py index de004c9d..ad2d1fa7 100644 --- a/resources/lib/playlist_func.py +++ b/resources/lib/playlist_func.py @@ -126,13 +126,15 @@ class PlaylistObjectBaseclase(object): return True return False - def clear(self): + def clear(self, kodi=True): """ - Resets the playlist object to an empty playlist + Resets the playlist object to an empty playlist. + + Pass kodi=False in order to NOT clear the Kodi playqueue """ # kodi monitor's on_clear method will only be called if there were some # items to begin with - if self.kodi_pl.size() != 0: + if kodi and self.kodi_pl.size() != 0: self.kodi_onclear() self.kodi_pl.clear() # Clear Kodi playlist object self.items = [] @@ -423,7 +425,7 @@ def init_Plex_playlist(playlist, plex_id=None, kodi_item=None): Returns the first PKC playlist item or raises PlaylistError """ LOG.debug('Initializing the playlist %s on the Plex side', playlist) - playlist.clear() + playlist.clear(kodi=False) try: if plex_id: item = playlist_item_from_plex(plex_id)