Merge pull request #1249 from croneter/fix-playlist-keyerror

Fix rare KeyError: None when trying to sync playlists
This commit is contained in:
croneter 2020-12-18 15:53:55 +01:00 committed by GitHub
commit 56516d3e1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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