Fix PKC clearing Kodi playlist

This commit is contained in:
croneter 2018-02-03 15:12:10 +01:00
parent 35536fdc2f
commit bee845ca95
2 changed files with 7 additions and 5 deletions

View file

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

View file

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