Skip to content
Snippets Groups Projects
Commit d794c3c8 authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Fix get track data

parent 22b9dc3e
No related branches found
No related tags found
1 merge request!11Resolve "Fix fail on get track name"
This commit is part of merge request !11. Comments created here will be created in the context of that merge request.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.spotify.screensaver" <addon id="script.spotify.screensaver"
name="Spotify Screensaver" name="Spotify Screensaver"
version="0.0.6" version="0.0.7"
provider-name="Benoît Harrault"> provider-name="Benoît Harrault">
<requires> <requires>
<import addon="xbmc.python" version="2.25.0"/> <import addon="xbmc.python" version="2.25.0"/>
......
...@@ -153,16 +153,21 @@ class GUI(xbmcgui.WindowXMLDialog): ...@@ -153,16 +153,21 @@ class GUI(xbmcgui.WindowXMLDialog):
) )
data = response.json() data = response.json()
track_name = data['name'] track_name = data.get('name', '')
# album/track image # album/track image
album = data['album'] album = data.get('album')
images = album['images'] if album is not None:
image_url = images[0]['url'] images = album.get('images')
if images is not None:
imageLST.append( image = images[0]
xbmcgui.ListItem(track_name, thumbnailImage=image_url) if image is not None:
) image_url = image.get('url')
if image_url is not None:
imageLST.append(
xbmcgui.ListItem(
track_name, thumbnailImage=image_url)
)
except Exception as e: except Exception as e:
self.log('failed to get track data ' + str(e), xbmc.LOGERROR) self.log('failed to get track data ' + str(e), xbmc.LOGERROR)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment