mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
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:
parent
55234a7fa3
commit
427d7ee1fc
@ -185,7 +185,8 @@ class SpotifyMediaPlayer(MediaPlayerDevice):
|
|||||||
self._artist = ', '.join([artist.get('name')
|
self._artist = ', '.join([artist.get('name')
|
||||||
for artist in item.get('artists')])
|
for artist in item.get('artists')])
|
||||||
self._uri = current.get('uri')
|
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
|
# Playing state
|
||||||
self._state = STATE_PAUSED
|
self._state = STATE_PAUSED
|
||||||
if current.get('is_playing'):
|
if current.get('is_playing'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user