Don't let librarysync crash if Plex playlist deletion doesnt work

This commit is contained in:
Croneter 2018-05-02 18:05:27 +02:00
parent 3016c9747f
commit 81b1d18192

View file

@ -284,11 +284,13 @@ def process_websocket(plex_id, updated_at, state):
""" """
create = False create = False
playlist = playlist_object_from_db(plex_id=plex_id) playlist = playlist_object_from_db(plex_id=plex_id)
try:
if playlist and state == 9: if playlist and state == 9:
LOG.debug('Plex deletion of playlist detected: %s', playlist) LOG.debug('Plex deletion of playlist detected: %s', playlist)
delete_kodi_playlist(playlist) delete_kodi_playlist(playlist)
elif playlist and playlist.plex_updatedat == updated_at: elif playlist and playlist.plex_updatedat == updated_at:
LOG.debug('Playlist with id %s already synced: %s', plex_id, playlist) LOG.debug('Playlist with id %s already synced: %s',
plex_id, playlist)
elif playlist: elif playlist:
LOG.debug('Change of Plex playlist detected: %s', playlist) LOG.debug('Change of Plex playlist detected: %s', playlist)
delete_kodi_playlist(playlist) delete_kodi_playlist(playlist)
@ -298,7 +300,6 @@ def process_websocket(plex_id, updated_at, state):
create = True create = True
# To the actual work # To the actual work
if create: if create:
try:
create_kodi_playlist(plex_id=plex_id, updated_at=updated_at) create_kodi_playlist(plex_id=plex_id, updated_at=updated_at)
except PL.PlaylistError: except PL.PlaylistError:
pass pass