Fix updating playlist object from XML

This commit is contained in:
Croneter 2018-05-01 16:41:10 +02:00
parent 1a3a94894b
commit 7dde71734c

View file

@ -428,17 +428,13 @@ def get_playlist_details_from_xml(playlist, xml):
Raises PlaylistError if something went wrong. Raises PlaylistError if something went wrong.
""" """
try: playlist.id = xml.get('%sID' % playlist.kind)
playlist.id = xml.attrib['%sID' % playlist.kind] playlist.version = xml.get('%sVersion' % playlist.kind)
playlist.version = xml.attrib['%sVersion' % playlist.kind] playlist.shuffled = xml.get('%sShuffled' % playlist.kind)
playlist.shuffled = xml.attrib['%sShuffled' % playlist.kind] playlist.selectedItemID = xml.get('%sSelectedItemID' % playlist.kind)
playlist.selectedItemID = xml.attrib.get( playlist.selectedItemOffset = xml.get(
'%sSelectedItemID' % playlist.kind) '%sSelectedItemOffset' % playlist.kind)
playlist.selectedItemOffset = xml.attrib.get( LOG.debug('Updated playlist from xml: %s', playlist)
'%sSelectedItemOffset' % playlist.kind)
LOG.debug('Updated playlist from xml: %s', playlist)
except (TypeError, KeyError, AttributeError):
raise PlaylistError('Could not get playlist details from xml')
def update_playlist_from_PMS(playlist, playlist_id=None, xml=None): def update_playlist_from_PMS(playlist, playlist_id=None, xml=None):