Merge pull request #1460 from croneter/fix-attributeerror
Fix a rare AttributeError when using playlists
This commit is contained in:
commit
7c12b7aa36
1 changed files with 6 additions and 4 deletions
|
@ -410,9 +410,9 @@ def _get_playListVersion_from_xml(playlist, xml):
|
||||||
|
|
||||||
Raises PlaylistError if unsuccessful
|
Raises PlaylistError if unsuccessful
|
||||||
"""
|
"""
|
||||||
playlist.version = utils.cast(int,
|
try:
|
||||||
xml.get('%sVersion' % playlist.kind))
|
playlist.version = int(xml.get('%sVersion' % playlist.kind))
|
||||||
if playlist.version is None:
|
except (AttributeError, TypeError):
|
||||||
raise PlaylistError('Could not get new playlist Version for playlist '
|
raise PlaylistError('Could not get new playlist Version for playlist '
|
||||||
'%s' % playlist)
|
'%s' % playlist)
|
||||||
|
|
||||||
|
@ -424,6 +424,8 @@ def get_playlist_details_from_xml(playlist, xml):
|
||||||
|
|
||||||
Raises PlaylistError if something went wrong.
|
Raises PlaylistError if something went wrong.
|
||||||
"""
|
"""
|
||||||
|
if xml is None:
|
||||||
|
raise PlaylistError('No playlist received for playlist %s' % playlist)
|
||||||
playlist.id = utils.cast(int,
|
playlist.id = utils.cast(int,
|
||||||
xml.get('%sID' % playlist.kind))
|
xml.get('%sID' % playlist.kind))
|
||||||
playlist.version = utils.cast(int,
|
playlist.version = utils.cast(int,
|
||||||
|
@ -711,8 +713,8 @@ def delete_playlist_item_from_PMS(playlist, pos):
|
||||||
playlist.items[pos].id,
|
playlist.items[pos].id,
|
||||||
playlist.repeat),
|
playlist.repeat),
|
||||||
action_type="DELETE")
|
action_type="DELETE")
|
||||||
_get_playListVersion_from_xml(playlist, xml)
|
|
||||||
del playlist.items[pos]
|
del playlist.items[pos]
|
||||||
|
_get_playListVersion_from_xml(playlist, xml)
|
||||||
|
|
||||||
|
|
||||||
# Functions operating on the Kodi playlist objects ##########
|
# Functions operating on the Kodi playlist objects ##########
|
||||||
|
|
Loading…
Reference in a new issue