From 7dde71734c82169e8056674c48864c922f25ad7f Mon Sep 17 00:00:00 2001 From: Croneter Date: Tue, 1 May 2018 16:41:10 +0200 Subject: [PATCH] Fix updating playlist object from XML --- resources/lib/playlist_func.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/resources/lib/playlist_func.py b/resources/lib/playlist_func.py index 07b4f02e..1baa9403 100644 --- a/resources/lib/playlist_func.py +++ b/resources/lib/playlist_func.py @@ -428,17 +428,13 @@ def get_playlist_details_from_xml(playlist, xml): Raises PlaylistError if something went wrong. """ - try: - playlist.id = xml.attrib['%sID' % playlist.kind] - playlist.version = xml.attrib['%sVersion' % playlist.kind] - playlist.shuffled = xml.attrib['%sShuffled' % playlist.kind] - playlist.selectedItemID = xml.attrib.get( - '%sSelectedItemID' % playlist.kind) - playlist.selectedItemOffset = xml.attrib.get( - '%sSelectedItemOffset' % playlist.kind) - LOG.debug('Updated playlist from xml: %s', playlist) - except (TypeError, KeyError, AttributeError): - raise PlaylistError('Could not get playlist details from xml') + playlist.id = xml.get('%sID' % playlist.kind) + playlist.version = xml.get('%sVersion' % playlist.kind) + playlist.shuffled = xml.get('%sShuffled' % playlist.kind) + playlist.selectedItemID = xml.get('%sSelectedItemID' % playlist.kind) + playlist.selectedItemOffset = xml.get( + '%sSelectedItemOffset' % playlist.kind) + LOG.debug('Updated playlist from xml: %s', playlist) def update_playlist_from_PMS(playlist, playlist_id=None, xml=None):