Skip to content

Commit

Permalink
[ 1.0.76 ] * Updated logic to correctly account for idle state; the i…
Browse files Browse the repository at this point in the history
…ntegration will go into idle state (instead of staying in paused state) after it detects that the Spotify Web API has dropped the current play state (e.g. the device disconnects from Spotify Connect).

  * Added extra state attribute: `sp_source_list_hide` - List of device names (in lower-case) to hide from the source list.
  * Updated underlying `spotifywebapiPython` package requirement to version 1.0.130.
  • Loading branch information
thlucas1 committed Dec 28, 2024
1 parent 5b5db36 commit 897b92c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ Change are listed in reverse chronological order (newest to oldest).

<span class="changelog">

###### [ 1.0.76 ] - 2024/12/28

* Updated logic to correctly account for idle state; the integration will go into idle state (instead of staying in paused state) after it detects that the Spotify Web API has dropped the current play state (e.g. the device disconnects from Spotify Connect).
* Added extra state attribute: `sp_source_list_hide` - List of device names (in lower-case) to hide from the source list.
* Updated underlying `spotifywebapiPython` package requirement to version 1.0.130.

###### [ 1.0.75 ] - 2024/12/21

* Added service `get_cover_image_file` to get the contents of an image url and transfer the contents to the local file system. This service should only be used to download images for playlists that contain public domain images. It should not be used to download copyright protected images, as that would violate the Spotify Web API Terms of Service.
Expand Down
2 changes: 1 addition & 1 deletion custom_components/spotifyplus/instancedata_spotifyplus.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def OptionScriptTurnOn(self) -> str | None:
@property
def OptionSourceListHide(self) -> list:
"""
The list of devices to hide from the source list.
The list of device names (in lower-case) to hide from the source list.
"""
result:list = []

Expand Down
4 changes: 2 additions & 2 deletions custom_components/spotifyplus/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"requests_oauthlib>=1.3.1",
"soco>=0.30.4",
"smartinspectPython>=3.0.33",
"spotifywebapiPython>=1.0.129",
"spotifywebapiPython>=1.0.130",
"urllib3>=1.21.1,<1.27",
"zeroconf>=0.132.2"
],
"version": "1.0.75",
"version": "1.0.76",
"zeroconf": [ "_spotify-connect._tcp.local." ]
}
7 changes: 6 additions & 1 deletion custom_components/spotifyplus/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
ATTR_SPOTIFYPLUS_PLAYING_TYPE = "sp_playing_type"
ATTR_SPOTIFYPLUS_PLAYLIST_NAME = "sp_playlist_name"
ATTR_SPOTIFYPLUS_PLAYLIST_URI = "sp_playlist_uri"
ATTR_SPOTIFYPLUS_SOURCE_LIST_HIDE = "sp_source_list_hide"
ATTR_SPOTIFYPLUS_TRACK_IS_EXPLICIT = "sp_track_is_explicit"
ATTR_SPOTIFYPLUS_USER_COUNTRY = "sp_user_country"
ATTR_SPOTIFYPLUS_USER_DISPLAY_NAME = "sp_user_display_name"
Expand Down Expand Up @@ -440,7 +441,9 @@ def extra_state_attributes(self) -> dict:
attributes[ATTR_SPOTIFYPLUS_USER_PRODUCT] = ATTRVALUE_UNKNOWN
attributes[ATTR_SPOTIFYPLUS_USER_URI] = ATTRVALUE_UNKNOWN

self.data.spotifyClient.UserProfile.DisplayName
# add configuration options information.
if (self.data is not None):
attributes[ATTR_SPOTIFYPLUS_SOURCE_LIST_HIDE] = self.data.OptionSourceListHide

# add currently active playstate information.
if self._playerState is not None:
Expand Down Expand Up @@ -1640,6 +1643,8 @@ def _UpdateHAFromPlayerPlayState(self, playerPlayState:PlayerPlayState) -> None:
if self._attr_state is not MediaPlayerState.OFF:
if self._isInCommandEvent:
pass
elif (playerPlayState.IsEmpty):
self._attr_state = MediaPlayerState.IDLE
elif playerPlayState.IsPlaying == True:
self._attr_state = MediaPlayerState.PLAYING
elif playerPlayState.IsPlaying == False:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ homeassistant==2024.5.0
ruff==0.1.3
soco>=0.30.4
smartinspectPython>=3.0.33
spotifywebapiPython>=1.0.129
spotifywebapiPython>=1.0.130

0 comments on commit 897b92c

Please sign in to comment.