From 7753903c050b98be1492bfe9a516475f7b8bc1cf Mon Sep 17 00:00:00 2001 From: croneter Date: Fri, 19 Apr 2019 17:54:18 +0200 Subject: [PATCH] Be more resiliant when manipulating Plex playqueues --- resources/lib/playlist_func.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/resources/lib/playlist_func.py b/resources/lib/playlist_func.py index cf583aaa..e571e5a1 100644 --- a/resources/lib/playlist_func.py +++ b/resources/lib/playlist_func.py @@ -703,8 +703,13 @@ def move_playlist_item(playlist, before_pos, after_pos): playlist.items[before_pos].id, playlist.items[after_pos - 1].id) # We need to increment the playlistVersion - _get_playListVersion_from_xml( - playlist, DU().downloadUrl(url, action_type="PUT")) + xml = DU().downloadUrl(url, action_type="PUT") + try: + xml[0].attrib + except (TypeError, IndexError, AttributeError): + LOG.error('Could not move playlist item') + return + _get_playListVersion_from_xml(playlist, xml) # Move our item's position in our internal playlist playlist.items.insert(after_pos, playlist.items.pop(before_pos)) LOG.debug('Done moving for %s', playlist)