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

Merge branch '15-fix-fail-on-get-track-name' into 'master'

Resolve "Fix fail on get track name"

Closes #15

See merge request !11
parents 22b9dc3e d794c3c8
No related branches found
No related tags found
1 merge request!11Resolve "Fix fail on get track name"
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.spotify.screensaver"
name="Spotify Screensaver"
version="0.0.6"
version="0.0.7"
provider-name="Benoît Harrault">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
......
......@@ -153,15 +153,20 @@ class GUI(xbmcgui.WindowXMLDialog):
)
data = response.json()
track_name = data['name']
track_name = data.get('name', '')
# album/track image
album = data['album']
images = album['images']
image_url = images[0]['url']
album = data.get('album')
if album is not None:
images = album.get('images')
if images is not None:
image = images[0]
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)
xbmcgui.ListItem(
track_name, thumbnailImage=image_url)
)
except Exception as e:
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