Merge pull request #1704 from croneter/py3-fix-another-indexerror
Fix rare IndexError when trying to delete a playlist item
This commit is contained in:
commit
305eca76ce
1 changed files with 12 additions and 8 deletions
|
@ -876,14 +876,18 @@ def delete_playlist_item_from_PMS(playlist, pos):
|
||||||
Delete the item at position pos [int] on the Plex side and our playlists
|
Delete the item at position pos [int] on the Plex side and our playlists
|
||||||
"""
|
"""
|
||||||
LOG.debug('Deleting position %s for %s on the Plex side', pos, playlist)
|
LOG.debug('Deleting position %s for %s on the Plex side', pos, playlist)
|
||||||
xml = DU().downloadUrl("{server}/%ss/%s/items/%s?repeat=%s" %
|
try:
|
||||||
(playlist.kind,
|
xml = DU().downloadUrl("{server}/%ss/%s/items/%s?repeat=%s" %
|
||||||
playlist.id,
|
(playlist.kind,
|
||||||
playlist.items[pos].id,
|
playlist.id,
|
||||||
playlist.repeat),
|
playlist.items[pos].id,
|
||||||
action_type="DELETE")
|
playlist.repeat),
|
||||||
del playlist.items[pos]
|
action_type="DELETE")
|
||||||
_update_playlist_version(playlist, xml)
|
except IndexError:
|
||||||
|
raise PlaylistError('Position %s out of bound for %s' % (pos, playlist))
|
||||||
|
else:
|
||||||
|
del playlist.items[pos]
|
||||||
|
_update_playlist_version(playlist, xml)
|
||||||
|
|
||||||
|
|
||||||
# Functions operating on the Kodi playlist objects ##########
|
# Functions operating on the Kodi playlist objects ##########
|
||||||
|
|
Loading…
Reference in a new issue