Be more resiliant when manipulating Plex playqueues

This commit is contained in:
croneter 2019-04-19 17:54:18 +02:00
parent 4fa1f48b43
commit 7753903c05

View file

@ -703,8 +703,13 @@ def move_playlist_item(playlist, before_pos, after_pos):
playlist.items[before_pos].id, playlist.items[before_pos].id,
playlist.items[after_pos - 1].id) playlist.items[after_pos - 1].id)
# We need to increment the playlistVersion # We need to increment the playlistVersion
_get_playListVersion_from_xml( xml = DU().downloadUrl(url, action_type="PUT")
playlist, 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 # Move our item's position in our internal playlist
playlist.items.insert(after_pos, playlist.items.pop(before_pos)) playlist.items.insert(after_pos, playlist.items.pop(before_pos))
LOG.debug('Done moving for %s', playlist) LOG.debug('Done moving for %s', playlist)