diff --git a/CHANGELOG.md b/CHANGELOG.md index a1af584..95ff85b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,14 @@ Change are listed in reverse chronological order (newest to oldest). +###### [ 1.0.27 ] - 2024/06/12 + + * Added extra state attribute `media_playlist_content_id` that contains the Content ID of current playing playlist context if one is active; otherwise, None. + * Added property `media_player.media_playlist_content_id` that contains the Content ID of current playing playlist context if one is active; otherwise, None. + * Added property `media_player.media_playlist_content_type` that contains the Content Type of current playing playlist if one is playing; otherwise, None. + * Added property `media_player.media_playlist_description` that contains the Description of current playing playlist if one is playing; otherwise, None. + * Added property `media_player.media_playlist_image_url` that contains the Image URL of current playing playlist if one is playing; otherwise, None. + * Updated `use_ssl` description on all of the Zeroconf Device services. ###### [ 1.0.26 ] - 2024/06/10 diff --git a/custom_components/spotifyplus/manifest.json b/custom_components/spotifyplus/manifest.json index 7374c4e..b3e04c4 100644 --- a/custom_components/spotifyplus/manifest.json +++ b/custom_components/spotifyplus/manifest.json @@ -18,6 +18,6 @@ "urllib3>=1.21.1,<1.27", "zeroconf>=0.132.2" ], - "version": "1.0.26", + "version": "1.0.27", "zeroconf": [ "_spotify-connect._tcp.local." ] } diff --git a/custom_components/spotifyplus/media_player.py b/custom_components/spotifyplus/media_player.py index ed994d9..ee8b1da 100644 --- a/custom_components/spotifyplus/media_player.py +++ b/custom_components/spotifyplus/media_player.py @@ -361,6 +361,10 @@ def extra_state_attributes(self): if self._playerState.Device is not None: attributes[ATTR_SPOTIFYPLUS_DEVICE_ID] = self._playerState.Device.Id attributes[ATTR_SPOTIFYPLUS_DEVICE_NAME] = self._playerState.Device.Name + + # add currently active playlist information. + if self._playlist is not None: + attributes['media_playlist_content_id'] = self._playlist.Uri return attributes @@ -437,12 +441,44 @@ def media_track(self) -> int | None: @property def media_playlist(self): - """ Title of Playlist currently playing. """ + """ Title of current playing playlist. """ if self._playlist is not None: return self._playlist.Name return None + @property + @property + def media_playlist_content_id(self): + """ Content ID of current playing playlist. """ + if self._playlist is not None: + return self._playlist.Uri + return None + + + @property + def media_playlist_content_type(self): + """ Content Type of current playing playlist. """ + if self._playlist is not None: + return self._playlist.Type + return None + + + def media_playlist_description(self): + """ Description of current playing playlist. """ + if self._playlist is not None: + return self._playlist.Description + return None + + + @property + def media_playlist_image_url(self): + """ Image URL of current playing playlist. """ + if self._playlist is not None: + return self._playlist.ImageUrl + return None + + @property def source(self) -> str | None: """ Return the current playback device. """ @@ -921,7 +957,7 @@ def update(self) -> None: # did the now playing context change? context:Context = self._playerState.Context - if context is not None and (self._playlist is None or self._playlist.Uri != context.Uri): + if (context is not None) and (self._playlist is None or self._playlist.Uri != context.Uri): # yes - if it's a playlist, then we need to update the stored playlist reference. self._playlist = None @@ -942,6 +978,10 @@ def update(self) -> None: self._playlist = None + elif (context is None): + + self._playlist = None + except SpotifyWebApiError as ex: _logsi.LogException(None, ex) diff --git a/custom_components/spotifyplus/services.yaml b/custom_components/spotifyplus/services.yaml index 9388439..32ba083 100644 --- a/custom_components/spotifyplus/services.yaml +++ b/custom_components/spotifyplus/services.yaml @@ -1940,7 +1940,7 @@ zeroconf_device_connect: text: use_ssl: name: Use SSL? - description: Spotify Connect Zeroconf API version number that the device supports (e.g. False). + description: True if the host device utilizes HTTPS Secure Sockets Layer (SSL) support; otherwise, False to utilize HTTP. Default is False (HTTP). example: "False" required: false selector: diff --git a/custom_components/spotifyplus/strings.json b/custom_components/spotifyplus/strings.json index 3d6093f..8ada419 100644 --- a/custom_components/spotifyplus/strings.json +++ b/custom_components/spotifyplus/strings.json @@ -1108,7 +1108,7 @@ }, "use_ssl": { "name": "Use SSL?", - "description": "Spotify Connect Zeroconf API version number that the device supports (e.g. False)." + "description": "True if the host device utilizes HTTPS Secure Sockets Layer (SSL) support; otherwise, False to utilize HTTP. Default is False (HTTP)." }, "username": { "name": "Spotify User Name", @@ -1154,7 +1154,7 @@ }, "use_ssl": { "name": "Use SSL?", - "description": "Spotify Connect Zeroconf API version number that the device supports (e.g. False)." + "description": "True if the host device utilizes HTTPS Secure Sockets Layer (SSL) support; otherwise, False to utilize HTTP. Default is False (HTTP)." } } }, @@ -1184,7 +1184,7 @@ }, "use_ssl": { "name": "Use SSL?", - "description": "Spotify Connect Zeroconf API version number that the device supports (e.g. False)." + "description": "True if the host device utilizes HTTPS Secure Sockets Layer (SSL) support; otherwise, False to utilize HTTP. Default is False (HTTP)." } } }, diff --git a/custom_components/spotifyplus/translations/en.json b/custom_components/spotifyplus/translations/en.json index 3d6093f..8ada419 100644 --- a/custom_components/spotifyplus/translations/en.json +++ b/custom_components/spotifyplus/translations/en.json @@ -1108,7 +1108,7 @@ }, "use_ssl": { "name": "Use SSL?", - "description": "Spotify Connect Zeroconf API version number that the device supports (e.g. False)." + "description": "True if the host device utilizes HTTPS Secure Sockets Layer (SSL) support; otherwise, False to utilize HTTP. Default is False (HTTP)." }, "username": { "name": "Spotify User Name", @@ -1154,7 +1154,7 @@ }, "use_ssl": { "name": "Use SSL?", - "description": "Spotify Connect Zeroconf API version number that the device supports (e.g. False)." + "description": "True if the host device utilizes HTTPS Secure Sockets Layer (SSL) support; otherwise, False to utilize HTTP. Default is False (HTTP)." } } }, @@ -1184,7 +1184,7 @@ }, "use_ssl": { "name": "Use SSL?", - "description": "Spotify Connect Zeroconf API version number that the device supports (e.g. False)." + "description": "True if the host device utilizes HTTPS Secure Sockets Layer (SSL) support; otherwise, False to utilize HTTP. Default is False (HTTP)." } } },