mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 16:27:08 +00:00
Spotify integration hotfixes (#31835)
* Remove services file, incorrect info * Guard currently playing for being a NoneType * Revert "Guard currently playing for being a NoneType" This reverts commit f5f56b0db03b407e058d45cd3549af1388916e06. * Guard currently playing item is None * Process review suggestions
This commit is contained in:
parent
7705eb7941
commit
f26cbbdef9
@ -157,7 +157,8 @@ class SpotifyMediaPlayer(MediaPlayerDevice):
|
||||
@property
|
||||
def media_content_id(self) -> Optional[str]:
|
||||
"""Return the media URL."""
|
||||
return self._currently_playing.get("item", {}).get("name")
|
||||
item = self._currently_playing.get("item") or {}
|
||||
return item.get("name")
|
||||
|
||||
@property
|
||||
def media_content_type(self) -> Optional[str]:
|
||||
@ -203,7 +204,8 @@ class SpotifyMediaPlayer(MediaPlayerDevice):
|
||||
@property
|
||||
def media_title(self) -> Optional[str]:
|
||||
"""Return the media title."""
|
||||
return self._currently_playing.get("item", {}).get("name")
|
||||
item = self._currently_playing.get("item") or {}
|
||||
return item.get("name")
|
||||
|
||||
@property
|
||||
def media_artist(self) -> Optional[str]:
|
||||
@ -224,7 +226,8 @@ class SpotifyMediaPlayer(MediaPlayerDevice):
|
||||
@property
|
||||
def media_track(self) -> Optional[int]:
|
||||
"""Track number of current playing media, music track only."""
|
||||
return self._currently_playing.get("item", {}).get("track_number")
|
||||
item = self._currently_playing.get("item") or {}
|
||||
return item.get("track_number")
|
||||
|
||||
@property
|
||||
def media_playlist(self):
|
||||
|
@ -1,9 +0,0 @@
|
||||
play_playlist:
|
||||
description: Play a Spotify playlist.
|
||||
fields:
|
||||
media_content_id:
|
||||
description: Spotify URI of the playlist.
|
||||
example: 'spotify:playlist:0IpRnqCHSjun48oQRX1Dy7'
|
||||
random_song:
|
||||
description: True to select random song at start, False to start from beginning.
|
||||
example: true
|
Loading…
x
Reference in New Issue
Block a user