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,24 +284,25 @@ def process_websocket(plex_id, updated_at, state):
"""
create = False
playlist = playlist_object_from_db(plex_id=plex_id)
if playlist and state == 9:
LOG.debug('Plex deletion of playlist detected: %s', playlist)
delete_kodi_playlist(playlist)
elif playlist and playlist.plex_updatedat == updated_at:
LOG.debug('Playlist with id %s already synced: %s', plex_id, playlist)
elif playlist:
LOG.debug('Change of Plex playlist detected: %s', playlist)
delete_kodi_playlist(playlist)
create = True
elif not playlist and not state == 9:
LOG.debug('Creation of new Plex playlist detected: %s', plex_id)
create = True
# To the actual work
if create:
try:
try:
if playlist and state == 9:
LOG.debug('Plex deletion of playlist detected: %s', playlist)
delete_kodi_playlist(playlist)
elif playlist and playlist.plex_updatedat == updated_at:
LOG.debug('Playlist with id %s already synced: %s',
plex_id, playlist)
elif playlist:
LOG.debug('Change of Plex playlist detected: %s', playlist)
delete_kodi_playlist(playlist)
create = True
elif not playlist and not state == 9:
LOG.debug('Creation of new Plex playlist detected: %s', plex_id)
create = True
# To the actual work
if create:
create_kodi_playlist(plex_id=plex_id, updated_at=updated_at)
except PL.PlaylistError:
pass
except PL.PlaylistError:
pass
@LOCKER.lockthis