Check if album image(s) exist in spotify (#9024)

* Check if album image(s) exist in spotify

* Actually set the image to None

* Simplified using ternary operator
This commit is contained in:
Tom Matheussen 2017-08-17 22:39:20 +02:00 committed by Pascal Vizeli
parent 55234a7fa3
commit 427d7ee1fc

View File

@ -185,7 +185,8 @@ class SpotifyMediaPlayer(MediaPlayerDevice):
self._artist = ', '.join([artist.get('name')
for artist in item.get('artists')])
self._uri = current.get('uri')
self._image_url = item.get('album').get('images')[0].get('url')
images = item.get('album').get('images')
self._image_url = images[0].get('url') if images else None
# Playing state
self._state = STATE_PAUSED
if current.get('is_playing'):