Fix library sync crashing due to Plex photo albums

- Fixes #517
This commit is contained in:
croneter 2018-08-03 18:37:16 +02:00
parent 90b66882c5
commit 8322609ef9
2 changed files with 7 additions and 2 deletions

View file

@ -237,8 +237,6 @@ def sync_plex_playlist(plex_id=None, xml=None, playlist=None):
Pass in either the plex_id or an xml (where API(xml) will be used)
"""
if not state.SYNC_SPECIFIC_PLEX_PLAYLISTS:
return True
if playlist:
# Mainly once we DELETED a Plex playlist that we're NOT supposed
# to sync
@ -254,8 +252,13 @@ def sync_plex_playlist(plex_id=None, xml=None, playlist=None):
api = API(xml[0])
else:
api = API(xml)
if api.playlist_type() == v.PLEX_TYPE_PHOTO_PLAYLIST:
# Not supported by Kodi
return False
name = api.title()
typus = v.KODI_PLAYLIST_TYPE_FROM_PLEX[api.playlist_type()]
if not state.SYNC_SPECIFIC_PLEX_PLAYLISTS:
return True
if (not state.ENABLE_MUSIC and typus == v.PLEX_PLAYLIST_TYPE_AUDIO):
LOG.debug('Not synching Plex audio playlist')
return False

View file

@ -129,8 +129,10 @@ PLAYLIST_PATH_MUSIC = os.path.join(PLAYLIST_PATH, 'music')
PLEX_TYPE_AUDIO_PLAYLIST = 'audio'
PLEX_TYPE_VIDEO_PLAYLIST = 'video'
PLEX_TYPE_PHOTO_PLAYLIST = 'photo'
KODI_TYPE_AUDIO_PLAYLIST = 'music'
KODI_TYPE_VIDEO_PLAYLIST = 'video'
KODI_TYPE_PHOTO_PLAYLIST = None # Not supported yet
KODI_PLAYLIST_TYPE_FROM_PLEX = {
PLEX_TYPE_AUDIO_PLAYLIST: KODI_TYPE_AUDIO_PLAYLIST,
PLEX_TYPE_VIDEO_PLAYLIST: KODI_TYPE_VIDEO_PLAYLIST