Fix rare KeyError: None when trying to sync the playlist

This commit is contained in:
croneter 2020-12-17 17:33:55 +01:00
parent 3fd9fc4e3f
commit 1207ab485c

View file

@ -357,6 +357,10 @@ def sync_plex_playlist(playlist=None, xml=None, plex_id=None):
if api.playlist_type() == v.PLEX_TYPE_PHOTO_PLAYLIST: if api.playlist_type() == v.PLEX_TYPE_PHOTO_PLAYLIST:
# Not supported by Kodi # Not supported by Kodi
return False return False
elif api.playlist_type() is None:
# Encountered in logs, seems to be a malformed answer
LOG.error('Playlist type is missing: %s', api.xml.attrib)
return False
name = api.title() name = api.title()
typus = v.KODI_PLAYLIST_TYPE_FROM_PLEX[api.playlist_type()] typus = v.KODI_PLAYLIST_TYPE_FROM_PLEX[api.playlist_type()]
if (not app.SYNC.enable_music and typus == v.PLEX_PLAYLIST_TYPE_AUDIO): if (not app.SYNC.enable_music and typus == v.PLEX_PLAYLIST_TYPE_AUDIO):