From 87851921b82eab602c50c041bb903806a531893b Mon Sep 17 00:00:00 2001 From: Todd Lucas Date: Fri, 20 Sep 2024 12:13:33 -0500 Subject: [PATCH] [ 1.0.57 ] * Added service `get_audiobook_favorites` to get a list of the audiobooks saved in the current Spotify user's 'Your Library'. * Added service `get_episode_favorites` to get a list of the episodes saved in the current Spotify user's 'Your Library'. * Updated underlying `spotifywebapiPython` package requirement to version 1.0.97. --- CHANGELOG.md | 6 + custom_components/spotifyplus/__init__.py | 60 ++++++++ custom_components/spotifyplus/manifest.json | 4 +- custom_components/spotifyplus/media_player.py | 144 +++++++++++++++++- custom_components/spotifyplus/services.yaml | 134 +++++++++++++--- custom_components/spotifyplus/strings.json | 52 +++++++ .../spotifyplus/translations/en.json | 52 +++++++ requirements.txt | 2 +- 8 files changed, 432 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4a625b..2e67f60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ Change are listed in reverse chronological order (newest to oldest). +###### [ 1.0.57 ] - 2024/09/20 + + * Added service `get_audiobook_favorites` to get a list of the audiobooks saved in the current Spotify user's 'Your Library'. + * Added service `get_episode_favorites` to get a list of the episodes saved in the current Spotify user's 'Your Library'. + * Updated underlying `spotifywebapiPython` package requirement to version 1.0.97. + ###### [ 1.0.56 ] - 2024/09/19 * Updated underlying `spotifywebapiPython` package requirement to version 1.0.96. diff --git a/custom_components/spotifyplus/__init__.py b/custom_components/spotifyplus/__init__.py index d4484a3..c7b5edf 100644 --- a/custom_components/spotifyplus/__init__.py +++ b/custom_components/spotifyplus/__init__.py @@ -101,8 +101,10 @@ SERVICE_SPOTIFY_GET_ARTIST:str = 'get_artist' SERVICE_SPOTIFY_GET_ARTIST_ALBUMS:str = 'get_artist_albums' SERVICE_SPOTIFY_GET_ARTISTS_FOLLOWED:str = 'get_artists_followed' +SERVICE_SPOTIFY_GET_AUDIOBOOK_FAVORITES:str = 'get_audiobook_favorites' SERVICE_SPOTIFY_GET_BROWSE_CATEGORYS_LIST:str = 'get_browse_categorys_list' SERVICE_SPOTIFY_GET_CATEGORY_PLAYLISTS:str = 'get_category_playlists' +SERVICE_SPOTIFY_GET_EPISODE_FAVORITES:str = 'get_episode_favorites' SERVICE_SPOTIFY_GET_FEATURED_PLAYLISTS:str = 'get_featured_playlists' SERVICE_SPOTIFY_GET_PLAYER_DEVICES:str = 'get_player_devices' SERVICE_SPOTIFY_GET_PLAYER_NOW_PLAYING:str = 'get_player_now_playing' @@ -285,6 +287,16 @@ } ) +SERVICE_SPOTIFY_GET_AUDIOBOOK_FAVORITES_SCHEMA = vol.Schema( + { + vol.Required("entity_id"): cv.entity_id, + vol.Optional("limit", default=50): vol.All(vol.Range(min=0,max=50)), + vol.Optional("offset", default=0): vol.All(vol.Range(min=0,max=500)), + vol.Optional("limit_total", default=0): vol.All(vol.Range(min=0,max=9999)), + vol.Optional("sort_result"): cv.boolean, + } +) + SERVICE_SPOTIFY_GET_BROWSE_CATEGORYS_LIST_SCHEMA = vol.Schema( { vol.Required("entity_id"): cv.entity_id, @@ -306,6 +318,16 @@ } ) +SERVICE_SPOTIFY_GET_EPISODE_FAVORITES_SCHEMA = vol.Schema( + { + vol.Required("entity_id"): cv.entity_id, + vol.Optional("limit", default=50): vol.All(vol.Range(min=0,max=50)), + vol.Optional("offset", default=0): vol.All(vol.Range(min=0,max=500)), + vol.Optional("limit_total", default=0): vol.All(vol.Range(min=0,max=9999)), + vol.Optional("sort_result"): cv.boolean, + } +) + SERVICE_SPOTIFY_GET_FEATURED_PLAYLISTS_SCHEMA = vol.Schema( { vol.Required("entity_id"): cv.entity_id, @@ -1303,6 +1325,16 @@ async def service_handle_spotify_serviceresponse(service: ServiceCall) -> Servic _logsi.LogVerbose(STAppMessages.MSG_SERVICE_EXECUTE % (service.service, entity.name)) response = await hass.async_add_executor_job(entity.service_spotify_get_artists_followed, after, limit, limit_total, sort_result) + elif service.service == SERVICE_SPOTIFY_GET_AUDIOBOOK_FAVORITES: + + # get spotify audiobook favorites. + limit = service.data.get("limit") + offset = service.data.get("offset") + limit_total = service.data.get("limit_total") + sort_result = service.data.get("sort_result") + _logsi.LogVerbose(STAppMessages.MSG_SERVICE_EXECUTE % (service.service, entity.name)) + response = await hass.async_add_executor_job(entity.service_spotify_get_audiobook_favorites, limit, offset, limit_total, sort_result) + elif service.service == SERVICE_SPOTIFY_GET_BROWSE_CATEGORYS_LIST: # get spotify browse categorys. @@ -1324,6 +1356,16 @@ async def service_handle_spotify_serviceresponse(service: ServiceCall) -> Servic _logsi.LogVerbose(STAppMessages.MSG_SERVICE_EXECUTE % (service.service, entity.name)) response = await hass.async_add_executor_job(entity.service_spotify_get_category_playlists, category_id, limit, offset, country, limit_total, sort_result) + elif service.service == SERVICE_SPOTIFY_GET_EPISODE_FAVORITES: + + # get spotify episode (podcast) favorites. + limit = service.data.get("limit") + offset = service.data.get("offset") + limit_total = service.data.get("limit_total") + sort_result = service.data.get("sort_result") + _logsi.LogVerbose(STAppMessages.MSG_SERVICE_EXECUTE % (service.service, entity.name)) + response = await hass.async_add_executor_job(entity.service_spotify_get_episode_favorites, limit, offset, limit_total, sort_result) + elif service.service == SERVICE_SPOTIFY_GET_FEATURED_PLAYLISTS: # get spotify featured playlists. @@ -1853,6 +1895,15 @@ def _GetEntityFromServiceData(hass:HomeAssistant, service:ServiceCall, field_id: supports_response=SupportsResponse.ONLY, ) + _logsi.LogObject(SILevel.Verbose, STAppMessages.MSG_SERVICE_REQUEST_REGISTER % SERVICE_SPOTIFY_GET_AUDIOBOOK_FAVORITES, SERVICE_SPOTIFY_GET_AUDIOBOOK_FAVORITES_SCHEMA) + hass.services.async_register( + DOMAIN, + SERVICE_SPOTIFY_GET_AUDIOBOOK_FAVORITES, + service_handle_spotify_serviceresponse, + schema=SERVICE_SPOTIFY_GET_AUDIOBOOK_FAVORITES_SCHEMA, + supports_response=SupportsResponse.ONLY, + ) + _logsi.LogObject(SILevel.Verbose, STAppMessages.MSG_SERVICE_REQUEST_REGISTER % SERVICE_SPOTIFY_GET_BROWSE_CATEGORYS_LIST, SERVICE_SPOTIFY_GET_BROWSE_CATEGORYS_LIST_SCHEMA) hass.services.async_register( DOMAIN, @@ -1871,6 +1922,15 @@ def _GetEntityFromServiceData(hass:HomeAssistant, service:ServiceCall, field_id: supports_response=SupportsResponse.ONLY, ) + _logsi.LogObject(SILevel.Verbose, STAppMessages.MSG_SERVICE_REQUEST_REGISTER % SERVICE_SPOTIFY_GET_EPISODE_FAVORITES, SERVICE_SPOTIFY_GET_EPISODE_FAVORITES_SCHEMA) + hass.services.async_register( + DOMAIN, + SERVICE_SPOTIFY_GET_EPISODE_FAVORITES, + service_handle_spotify_serviceresponse, + schema=SERVICE_SPOTIFY_GET_EPISODE_FAVORITES_SCHEMA, + supports_response=SupportsResponse.ONLY, + ) + _logsi.LogObject(SILevel.Verbose, STAppMessages.MSG_SERVICE_REQUEST_REGISTER % SERVICE_SPOTIFY_GET_FEATURED_PLAYLISTS, SERVICE_SPOTIFY_GET_FEATURED_PLAYLISTS_SCHEMA) hass.services.async_register( DOMAIN, diff --git a/custom_components/spotifyplus/manifest.json b/custom_components/spotifyplus/manifest.json index 485ff4a..18fbfce 100644 --- a/custom_components/spotifyplus/manifest.json +++ b/custom_components/spotifyplus/manifest.json @@ -17,10 +17,10 @@ "requests>=2.31.0", "requests_oauthlib>=1.3.1", "smartinspectPython>=3.0.33", - "spotifywebapiPython>=1.0.96", + "spotifywebapiPython>=1.0.97", "urllib3>=1.21.1,<1.27", "zeroconf>=0.132.2" ], - "version": "1.0.56", + "version": "1.0.57", "zeroconf": [ "_spotify-connect._tcp.local." ] } diff --git a/custom_components/spotifyplus/media_player.py b/custom_components/spotifyplus/media_player.py index 88533ea..386c147 100644 --- a/custom_components/spotifyplus/media_player.py +++ b/custom_components/spotifyplus/media_player.py @@ -34,12 +34,14 @@ AlbumSimplified, Artist, ArtistPage, + AudiobookPageSimplified, AudioFeatures, Category, CategoryPage, Context, Device as PlayerDevice, Episode, + EpisodePageSaved, EpisodePageSimplified, ImageObject, PlayerPlayState, @@ -2560,6 +2562,76 @@ def service_spotify_get_artists_followed( _logsi.LeaveMethod(SILevel.Debug, apiMethodName) + def service_spotify_get_audiobook_favorites( + self, + limit:int, + offset:int, + limitTotal:int=None, + sortResult:bool=True, + ) -> dict: + """ + Get a list of the audiobooks saved in the current Spotify user's 'Your Library'. + + Args: + limit (int): + The maximum number of items to return in a page of items. + Default: 20, Range: 1 to 50. + offset (int): + The index of the first item to return. + Use with limit to get the next set of items. + Default: 0 (the first item). + limitTotal (int): + The maximum number of items to return for the request. + If specified, this argument overrides the limit and offset argument values + and paging is automatically used to retrieve all available items up to the + maximum count specified. + Default: None (disabled) + sortResult (bool): + True to sort the items by name; otherwise, False to leave the items in the same order they + were returned in by the Spotify Web API. + Default: True + + Returns: + A dictionary that contains the following keys: + - user_profile: A (partial) user profile that retrieved the result. + - result: A `AudiobookPageSimplified` object that contains saved audiobook information. + """ + apiMethodName:str = 'service_spotify_get_audiobook_favorites' + apiMethodParms:SIMethodParmListContext = None + + try: + + # trace. + apiMethodParms = _logsi.EnterMethodParmList(SILevel.Debug, apiMethodName) + apiMethodParms.AppendKeyValue("limit", limit) + apiMethodParms.AppendKeyValue("offset", offset) + apiMethodParms.AppendKeyValue("limitTotal", limitTotal) + apiMethodParms.AppendKeyValue("sortResult", sortResult) + _logsi.LogMethodParmList(SILevel.Verbose, "Spotify Get Audiobook Favorites Service", apiMethodParms) + + # request information from Spotify Web API. + _logsi.LogVerbose(STAppMessages.MSG_SERVICE_QUERY_WEB_API) + result:AudiobookPageSimplified = self.data.spotifyClient.GetAudiobookFavorites(limit, offset, limitTotal, sortResult) + + # return the (partial) user profile that retrieved the result, as well as the result itself. + return { + "user_profile": self._GetUserProfilePartialDictionary(self.data.spotifyClient.UserProfile), + "result": result.ToDictionary() + } + + # the following exceptions have already been logged, so we just need to + # pass them back to HA for display in the log (or service UI). + except SpotifyApiError as ex: + raise HomeAssistantError(ex.Message) + except SpotifyWebApiError as ex: + raise HomeAssistantError(ex.Message) + + finally: + + # trace. + _logsi.LeaveMethod(SILevel.Debug, apiMethodName) + + def service_spotify_get_browse_categorys_list(self, country:str=None, locale:str=None, @@ -2724,6 +2796,76 @@ def service_spotify_get_category_playlists( _logsi.LeaveMethod(SILevel.Debug, apiMethodName) + def service_spotify_get_episode_favorites( + self, + limit:int, + offset:int, + limitTotal:int=None, + sortResult:bool=True, + ) -> dict: + """ + Get a list of the episodes saved in the current Spotify user's 'Your Library'. + + Args: + limit (int): + The maximum number of items to return in a page of items. + Default: 20, Range: 1 to 50. + offset (int): + The index of the first item to return. + Use with limit to get the next set of items. + Default: 0 (the first item). + limitTotal (int): + The maximum number of items to return for the request. + If specified, this argument overrides the limit and offset argument values + and paging is automatically used to retrieve all available items up to the + maximum count specified. + Default: None (disabled) + sortResult (bool): + True to sort the items by name; otherwise, False to leave the items in the same order they + were returned in by the Spotify Web API. + Default: True + + Returns: + A dictionary that contains the following keys: + - user_profile: A (partial) user profile that retrieved the result. + - result: A `EpisodePageSaved` object that contains saved audiobook information. + """ + apiMethodName:str = 'service_spotify_get_episode_favorites' + apiMethodParms:SIMethodParmListContext = None + + try: + + # trace. + apiMethodParms = _logsi.EnterMethodParmList(SILevel.Debug, apiMethodName) + apiMethodParms.AppendKeyValue("limit", limit) + apiMethodParms.AppendKeyValue("offset", offset) + apiMethodParms.AppendKeyValue("limitTotal", limitTotal) + apiMethodParms.AppendKeyValue("sortResult", sortResult) + _logsi.LogMethodParmList(SILevel.Verbose, "Spotify Get Episode Favorites Service", apiMethodParms) + + # request information from Spotify Web API. + _logsi.LogVerbose(STAppMessages.MSG_SERVICE_QUERY_WEB_API) + result:EpisodePageSaved = self.data.spotifyClient.GetEpisodeFavorites(limit, offset, limitTotal, sortResult) + + # return the (partial) user profile that retrieved the result, as well as the result itself. + return { + "user_profile": self._GetUserProfilePartialDictionary(self.data.spotifyClient.UserProfile), + "result": result.ToDictionary() + } + + # the following exceptions have already been logged, so we just need to + # pass them back to HA for display in the log (or service UI). + except SpotifyApiError as ex: + raise HomeAssistantError(ex.Message) + except SpotifyWebApiError as ex: + raise HomeAssistantError(ex.Message) + + finally: + + # trace. + _logsi.LeaveMethod(SILevel.Debug, apiMethodName) + + def service_spotify_get_featured_playlists( self, limit:int=20, @@ -3761,7 +3903,7 @@ def service_spotify_get_tracks_audio_features( - user_profile: A (partial) user profile that retrieved the result. - result: A list of `AudioFeatures` objects that contain the audio feature details. """ - apiMethodName:str = 'service_spotify_get_track_favorites' + apiMethodName:str = 'service_spotify_get_tracks_audio_features' apiMethodParms:SIMethodParmListContext = None result:TrackPageSaved = TrackPageSaved() diff --git a/custom_components/spotifyplus/services.yaml b/custom_components/spotifyplus/services.yaml index 1cf1ed4..e014f6c 100644 --- a/custom_components/spotifyplus/services.yaml +++ b/custom_components/spotifyplus/services.yaml @@ -248,7 +248,7 @@ get_album_favorites: offset: name: Offset description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). - example: 20 + example: 0 required: false selector: number: @@ -304,7 +304,7 @@ get_album_new_releases: offset: name: Offset description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). - example: 20 + example: 0 required: false selector: number: @@ -395,7 +395,7 @@ get_artist_albums: offset: name: Offset description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). - example: 20 + example: 0 required: false selector: number: @@ -471,6 +471,55 @@ get_artists_followed: selector: boolean: +get_audiobook_favorites: + name: Get Audiobook Favorites + description: Get a list of the audiobooks saved in the current Spotify user's 'Your Library'. + fields: + entity_id: + name: Entity ID + description: Entity ID of the SpotifyPlus device that will make the request to the Spotify Web API. + example: "media_player.spotifyplus_username" + required: true + selector: + entity: + integration: spotifyplus + domain: media_player + limit: + name: Limit + description: The maximum number of items to return in a page of items when manual paging is used. Default is 20, Range is 1 to 50. See the limit_total argument for automatic paging option. + example: 20 + required: false + selector: + number: + min: 1 + max: 50 + mode: box + offset: + name: Offset + description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). + example: 0 + required: false + selector: + number: + min: 1 + max: 500 + mode: box + limit_total: + name: Limit Total + description: The maximum number of items to return for the request. If specified, this argument overrides the limit and offset argument values and paging is automatically used to retrieve all available items up to the specified limit total. + example: 20 + required: false + selector: + number: + mode: box + sort_result: + name: Sort Result? + description: True to sort result items by name prior to returning to the caller; otherwise, False to return results in the order that the Spotify Web API returned them. + example: "True" + required: false + selector: + boolean: + get_browse_categorys_list: name: Get Browse Categorys List description: Get a sorted list of ALL categories used to tag items in Spotify. @@ -539,7 +588,7 @@ get_category_playlists: offset: name: Offset description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). - example: 20 + example: 0 required: false selector: number: @@ -569,6 +618,55 @@ get_category_playlists: selector: boolean: +get_episode_favorites: + name: Get Episode Favorites + description: Get a list of the episodes saved in the current Spotify user's 'Your Library'. + fields: + entity_id: + name: Entity ID + description: Entity ID of the SpotifyPlus device that will make the request to the Spotify Web API. + example: "media_player.spotifyplus_username" + required: true + selector: + entity: + integration: spotifyplus + domain: media_player + limit: + name: Limit + description: The maximum number of items to return in a page of items when manual paging is used. Default is 20, Range is 1 to 50. See the limit_total argument for automatic paging option. + example: 20 + required: false + selector: + number: + min: 1 + max: 50 + mode: box + offset: + name: Offset + description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). + example: 0 + required: false + selector: + number: + min: 1 + max: 500 + mode: box + limit_total: + name: Limit Total + description: The maximum number of items to return for the request. If specified, this argument overrides the limit and offset argument values and paging is automatically used to retrieve all available items up to the specified limit total. + example: 20 + required: false + selector: + number: + mode: box + sort_result: + name: Sort Result? + description: True to sort result items by name prior to returning to the caller; otherwise, False to return results in the order that the Spotify Web API returned them. + example: "True" + required: false + selector: + boolean: + get_featured_playlists: name: Get Featured Playlists description: Get a list of Spotify featured playlists. @@ -595,7 +693,7 @@ get_featured_playlists: offset: name: Offset description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). - example: 20 + example: 0 required: false selector: number: @@ -857,7 +955,7 @@ get_playlist_favorites: offset: name: Offset description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). - example: 20 + example: 0 required: false selector: number: @@ -941,7 +1039,7 @@ get_show_episodes: offset: name: Offset description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). - example: 20 + example: 0 required: false selector: number: @@ -990,7 +1088,7 @@ get_show_favorites: offset: name: Offset description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). - example: 20 + example: 0 required: false selector: number: @@ -1129,7 +1227,7 @@ get_track_favorites: offset: name: Offset description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). - example: 20 + example: 0 required: false selector: number: @@ -1213,7 +1311,7 @@ get_users_top_artists: offset: name: Offset description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). - example: 20 + example: 0 required: false selector: number: @@ -1269,7 +1367,7 @@ get_users_top_tracks: offset: name: Offset description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). - example: 20 + example: 0 required: false selector: number: @@ -2171,7 +2269,7 @@ search_albums: offset: name: Offset description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). - example: 20 + example: 0 required: false selector: number: @@ -2234,7 +2332,7 @@ search_artists: offset: name: Offset description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). - example: 20 + example: 0 required: false selector: number: @@ -2297,7 +2395,7 @@ search_audiobooks: offset: name: Offset description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). - example: 20 + example: 0 required: false selector: number: @@ -2360,7 +2458,7 @@ search_episodes: offset: name: Offset description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). - example: 20 + example: 0 required: false selector: number: @@ -2423,7 +2521,7 @@ search_playlists: offset: name: Offset description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). - example: 20 + example: 0 required: false selector: number: @@ -2486,7 +2584,7 @@ search_shows: offset: name: Offset description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). - example: 20 + example: 0 required: false selector: number: @@ -2549,7 +2647,7 @@ search_tracks: offset: name: Offset description: The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item). - example: 20 + example: 0 required: false selector: number: diff --git a/custom_components/spotifyplus/strings.json b/custom_components/spotifyplus/strings.json index 462de79..4c31313 100644 --- a/custom_components/spotifyplus/strings.json +++ b/custom_components/spotifyplus/strings.json @@ -348,6 +348,32 @@ } } }, + "get_audiobook_favorites": { + "name": "Get Audiobook Favorites", + "description": "Get a list of the audiobooks saved in the current Spotify user's 'Your Library'.", + "fields": { + "entity_id": { + "name": "Entity ID", + "description": "Entity ID of the SpotifyPlus device that will make the request to the Spotify Web API." + }, + "limit": { + "name": "Limit", + "description": "The maximum number of items to return in a page of items when manual paging is used. Default is 20, Range is 1 to 50. See the limit_total argument for automatic paging option." + }, + "offset": { + "name": "Offset", + "description": "The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item)." + }, + "limit_total": { + "name": "Limit Total", + "description": "The maximum number of items to return for the request. If specified, this argument overrides the limit and offset argument values and paging is automatically used to retrieve all available items up to the specified limit total." + }, + "sort_result": { + "name": "Sort Result?", + "description": "True to sort result items by name prior to returning to the caller; otherwise, False to return results in the order that the Spotify Web API returned them." + } + } + }, "get_browse_categorys": { "name": "Get Browse Categorys", "description": "Get a sorted list of ALL categories used to tag items in Spotify.", @@ -404,6 +430,32 @@ } } }, + "get_episode_favorites": { + "name": "Get Episode Favorites", + "description": "Get a list of the episodes saved in the current Spotify user's 'Your Library'.", + "fields": { + "entity_id": { + "name": "Entity ID", + "description": "Entity ID of the SpotifyPlus device that will make the request to the Spotify Web API." + }, + "limit": { + "name": "Limit", + "description": "The maximum number of items to return in a page of items when manual paging is used. Default is 20, Range is 1 to 50. See the limit_total argument for automatic paging option." + }, + "offset": { + "name": "Offset", + "description": "The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item)." + }, + "limit_total": { + "name": "Limit Total", + "description": "The maximum number of items to return for the request. If specified, this argument overrides the limit and offset argument values and paging is automatically used to retrieve all available items up to the specified limit total." + }, + "sort_result": { + "name": "Sort Result?", + "description": "True to sort result items by name prior to returning to the caller; otherwise, False to return results in the order that the Spotify Web API returned them." + } + } + }, "get_featured_playlists": { "name": "Get Featured Playlists", "description": "Get a list of Spotify featured playlists.", diff --git a/custom_components/spotifyplus/translations/en.json b/custom_components/spotifyplus/translations/en.json index 462de79..4c31313 100644 --- a/custom_components/spotifyplus/translations/en.json +++ b/custom_components/spotifyplus/translations/en.json @@ -348,6 +348,32 @@ } } }, + "get_audiobook_favorites": { + "name": "Get Audiobook Favorites", + "description": "Get a list of the audiobooks saved in the current Spotify user's 'Your Library'.", + "fields": { + "entity_id": { + "name": "Entity ID", + "description": "Entity ID of the SpotifyPlus device that will make the request to the Spotify Web API." + }, + "limit": { + "name": "Limit", + "description": "The maximum number of items to return in a page of items when manual paging is used. Default is 20, Range is 1 to 50. See the limit_total argument for automatic paging option." + }, + "offset": { + "name": "Offset", + "description": "The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item)." + }, + "limit_total": { + "name": "Limit Total", + "description": "The maximum number of items to return for the request. If specified, this argument overrides the limit and offset argument values and paging is automatically used to retrieve all available items up to the specified limit total." + }, + "sort_result": { + "name": "Sort Result?", + "description": "True to sort result items by name prior to returning to the caller; otherwise, False to return results in the order that the Spotify Web API returned them." + } + } + }, "get_browse_categorys": { "name": "Get Browse Categorys", "description": "Get a sorted list of ALL categories used to tag items in Spotify.", @@ -404,6 +430,32 @@ } } }, + "get_episode_favorites": { + "name": "Get Episode Favorites", + "description": "Get a list of the episodes saved in the current Spotify user's 'Your Library'.", + "fields": { + "entity_id": { + "name": "Entity ID", + "description": "Entity ID of the SpotifyPlus device that will make the request to the Spotify Web API." + }, + "limit": { + "name": "Limit", + "description": "The maximum number of items to return in a page of items when manual paging is used. Default is 20, Range is 1 to 50. See the limit_total argument for automatic paging option." + }, + "offset": { + "name": "Offset", + "description": "The page index offset of the first item to return. Use with limit to get the next set of items. Default is 0 (the first item)." + }, + "limit_total": { + "name": "Limit Total", + "description": "The maximum number of items to return for the request. If specified, this argument overrides the limit and offset argument values and paging is automatically used to retrieve all available items up to the specified limit total." + }, + "sort_result": { + "name": "Sort Result?", + "description": "True to sort result items by name prior to returning to the caller; otherwise, False to return results in the order that the Spotify Web API returned them." + } + } + }, "get_featured_playlists": { "name": "Get Featured Playlists", "description": "Get a list of Spotify featured playlists.", diff --git a/requirements.txt b/requirements.txt index 6753a61..8527bd2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,4 @@ colorlog==6.7.0 homeassistant==2024.5.0 ruff==0.1.3 smartinspectPython>=3.0.33 -spotifywebapiPython>=1.0.96 +spotifywebapiPython>=1.0.97