__init__
Spotify Web API Python3 Library
Overview
This API provides Python programmers the ability to retrieve information from the Spotify Web API from any program written in Python 3. It also allows player control via Spotify Connect devices.
More information about the Spotify Web API can be found on the Spotify Developer Portal page.
IMPORTANT This API assumes you will adhere to all of the terms set forth in the Spotify Developer Terms of Use. The developers of this API are not responsible for misuse of the underlying Spotify Web API.
Features
This API supports all of the features of the Spotify Web API including access to all end points, and support for user authorization with scope(s). Check out the Spotify Web API documentation page for more details.
The following features are supported by this API.
- Authorization: Token generation (Authorization Code, Authorization Code PKCE, Client Credentials) with Scope(s), auto token storage and renewal.
- Albums: Get Album(s), Get Album Tracks, User Favorites (Get,Add,Remove,Check), Get New Releases.
- Artists: Get Artist(s), Get Artist's Albums, Get Artist's Top Tracks, Get Related Artists.
- Audiobooks: Get Audiobook(s), Get Audiobook Chapters, User Favorites (Get,Add,Remove,Check).
- Categories: Get Several Browse Categories, Get Single Browse Category.
- Chapters: Get a Chapter, Get Several Chapters.
- Episodes: Get Episode(s), User Favorites (Get,Add,Remove,Check).
- Genres: Get Available Genre Seeds.
- Markets: Get Available Markets.
- Player: Get Playback State, Transfer Playback, Get Available Devices, Get Currently Playing Track, Start/Resume/Pause/Skip/Seek/Repeat/Shuffle/Volume Playback, Get Recently Played Tracks, Get the User's Queue, Add Item to Playback Queue.
- Playlists: Get Playlist(s), Change Playlist Details, Get/Update/Add/Remove Playlist Items, Get Favorites, Get User's Playlists, Create Playlist, Get Featured Playlists, Get Category's Playlists, Get Playlist Cover Image, Add Custom Playlist Cover Image
- Search: Search for Albums/Artists/Audiobooks/Episodes/Playlists/Shows/Tracks.
- Shows: Get Show(s), Get Show Episodes, User Favorites (Get,Add,Remove,Check).
- Tracks: Get Track(s), User Favorites (Get,Add,Remove,Check), Get Track(s) Audio Features, Recommendations, Analysis.
- Users: Get Current/Another User's Profile, Get Top Items, Favorites (Follow,Unfollow,Check) Artists/Playlist/Users.
- Supports caching of rarely changed configuration data: Categories, Devices, Genres, Markets, UserProfile, etc.
- ... and more
Requirements and Dependencies
The following requirements must be met in order to utilize this API:
- You must have a Spotify account (free or premium). Note that some API functions require a PREMIUM account in order to work. Check the Spotify Developer Documentation pages for more details.
- You will need to create a Spotify App in order to access the Spotify Web API. An App provides the Client ID and Client Secret needed to request an access token by implementing any of the OAuth2 authorization flows. More information about creating an application can be found on the Spotify Getting started with Web API page.
The following Python-related requirements must be met in order to utilize this API:
- Python 3.9 or greater (Python 2 not supported).
Documentation
Documentation is located in the package library under the 'docs' folder; use the index.html as your starting point. You can also view the latest docs on the readthedocs web-site.
Installation
This module can be easily installed via pip:
$ python3 -m pip install spotifywebapipython
Quick-Start Sample Code
Almost every method is documented with sample code; just click on the "Sample Code" links under the method, and use the "Copy to Clipboard" functionality to copy / paste.
Check out the following classes to get you started:
spotifywebapipython.spotifyclient.SpotifyClient- main client class.
Licensing
This project is licensed and distributed under the terms of the MIT End-User License Agreement (EULA) license.
Logging / Tracing Support
The SmartInspectPython package (installed with this package) can be used to easily debug your applications that utilize this API.
The following topics and code samples will get you started on how to enable logging support.
Note that logging support can be turned on and off without changing code or restarting the application.
Click on the topics below to expand the section and reveal more information.
Configure Logging Support Settings File
Add the following lines to a new file (e.g. "smartinspect.cfg") in your application startup / test directory.
Note the file name can be whatever you like, just specify it on the call to SiAuto.Si.LoadConfiguration() when initializing the logger.
; smartinspect.cfg
; SmartInspect Logging Configuration General settings.
; - "Enabled" parameter to turn logging on (True) or off (False).
; - "Level" parameter to control the logging level (Debug|Verbose|Message|Warning|Error).
; - "AppName" parameter to control the application name.
Enabled = False
Level = Verbose
DefaultLevel = Debug
AppName = My Application Name
; SmartInspect Logging Configuration Output settings.
; - Log to SmartInspect Console Viewer running on the specified network address.
Connections = tcp(host=192.168.1.1,port=4228,timeout=5000,reconnect=true,reconnect.interval=10s,async.enabled=true)
; - Log to a file, keeping 14 days worth of logs.
;Connections = "file(filename=\"./tests/logfiles/logfile.log\", rotate=daily, maxparts=14, append=true)"
; - Log to an encrypted file, keeping 14 days worth of logs.
;Connections = "file(filename=\"./tests/logfiles/logfileEncrypted.sil\", encrypt=true, key=""1234567890123456"", rotate=daily, maxparts=14, append=true)"
; set defaults for new sessions
; note that session defaults do not apply to the SiAuto.Main session, since
; this session was already added before a configuration file can be loaded.
; session defaults only apply to newly added sessions and do not affect existing sessions.
SessionDefaults.Active = True
SessionDefaults.Level = Message
SessionDefaults.ColorBG = 0xFFFFFF
; configure some individual session properties.
; note that this does not add the session to the sessionmanager; it simply
; sets the property values IF the session name already exists.
Session.Main.Active = True
Session.Main.ColorBG = 0xFFFFFF
Initialize Logging Support, MAIN module
Add the following lines to your program startup module.
This will import the necessary package modules, and initialize logging support.
NOTE - This code should only be executed one time!
# load SmartInspect settings from a configuration settings file.
from smartinspectpython.siauto import *
siConfigPath:str = "./tests/smartinspect.cfg"
SIAuto.Si.LoadConfiguration(siConfigPath)
# start monitoring the configuration file for changes, and reload it when it changes.
# this will check the file for changes every 60 seconds.
siConfig:SIConfigurationTimer = SIConfigurationTimer(SIAuto.Si, siConfigPath)
# get smartinspect logger reference.
_logsi:SISession = SIAuto.Main
# log system environment and application startup parameters.
_logsi.LogSeparator(SILevel.Fatal)
_logsi.LogAppDomain(SILevel.Verbose)
_logsi.LogSystem(SILevel.Verbose)
Initialize Logging Support, CLASS or sub-modules
Add the following lines to your program supporting modules.
This will import the necessary package modules, and initialize the shared logging session.
# get smartinspect logger reference.
from smartinspectpython.siauto import *
_logsi:SISession = SIAuto.Main
More Information on SmartInspect
You can use SmartInspectPython by itself to create log files for your own applications.
Use the following PIP command to install the SmartInspectPython package from PyPi.org:
$ python3 -m pip install smartinspectpython
The SmarrtInspect Redistributable Console Viewer (free) is required to view SmartInspect Log (.sil) formatted log files, as well capture packets via the TcpProtocol or PipeProtocol connections. The Redistributable Console Viewer can be downloaded from the Code-Partners Software Downloads Page. Note that the "Redistributable Console Viewer" is a free product, while the "SmartInspect Full Setup" is the Professional level viewer that adds a few more bells and whistles for a fee. Also note that a Console Viewer is NOT required to view plain text (non .sil) formatted log files.
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
- Fork the Project
- Create your Feature Branch
git checkout -b feature/AmazingFeature - Commit your Changes
git commit -m 'Add some AmazingFeature' - Push to the Branch
git push origin feature/AmazingFeature - Open a Pull Request
View Change Log
Change Log
All notable changes to this project are listed here.
Change are listed in reverse chronological order (newest to oldest).
[ 1.0.253 ] - 2025/10/27
- Updated
setup.pyminimum python version requirement frompython_requires='>3.11.0'topython_requires='>=3.11.0'so that Python 3.11.0 can be used.
[ 1.0.252 ] - 2025/10/15
- Updated
SpotifyMediaTypesto addPODCASTandUNKNOWNvalues. Also changed various code that referenced the constant values. - Updated model
ArtistInfoto addExternalURLsproperty.
[ 1.0.251 ] - 2025/10/12
- Updated build process to exclude test library from wheel file.
[ 1.0.250 ] - 2025/10/12
- Updated setup package requirement:
pillow>=11.3.0.
[ 1.0.249 ] - 2025/09/30
- Updated
EpisodeSimplifiedmodel to include origin fields to match theTrackSimplifiedmodel. Note that track relinking info is not present for episodes, but it's easier to have the same fields when process item information in playerstate calls (could be either track or episode).
[ 1.0.248 ] - 2025/09/27
- Updated
SpotifyClient.PlayerMediaPlayTrackFavoritesmethod to use the origin uri value for tracks that containlinked_fromdetails.
[ 1.0.247 ] - 2025/09/26
- Updated
SpotifyClient.GetTrackFavoritesmethod to allow thefilterArtistandfilterAlbumarguments to accept a Spotify URI value (e.g. "spotify:album:xxxxxx"). This allows you to return favorite tracks by an exact artist name, exact album name, or both.
[ 1.0.246 ] - 2025/09/26
- Updated
SpotifyClient.GetTrackFavoritesandPlayerMediaPlayTrackFavoritesmethods to include thefilterArtistandfilterAlbumarguments. This allows you to return favorite tracks by artist name, album name, or both.
[ 1.0.245 ] - 2025/09/22
- Updated
SpotifyConnectDirectoryTaskto increase thepychromecast.get_chromecast_from_hosttimeout value from 5 seconds to 10 seconds for cast group requests. - Updated
SpotifyConnectDirectoryTaskto increase thepychromecast.get_chromecast_from_cast_infotimeout value from 3 seconds to 5 seconds for cast group requests. - Added
ColorThiefFastclasses to support new image processing method. - Added
ImagePaletteColorsmodel that contains palette colors extracted from a processed image. - Added
SpotifyClient.GetImagePaletteColorsmethod that extracts color palette RGB values from the specified image url. - Added
numpy>=2.3.2package requirement tosetup.py.
[ 1.0.244 ] - 2025/09/19
- Updated
SpotifyConnectDirectoryTaskto properly register multizone controllers for group events. - Added
MultizoneManagerandMultiZoneManagerListenerclasses to listen for multizone events.
[ 1.0.243 ] - 2025/09/16
- Updated
SpotifyConnectDirectoryTaskto properly process Google Cast Group updates from "add_cast" events. These events seem to occur whenever the Cast Group leader changes.
[ 1.0.242 ] - 2025/09/13
- Updated
SpotifyClient.PlayerMediaPlayContextmethod (correctly this time!) to restore shuffle mode after play is started. Some players (e.g. HA SpotifyConnect AddOn, librespot, etc) reset the shuffle setting when starting context play.
[ 1.0.241 ] - 2025/09/13
- Updated
SpotifyClient.PlayerMediaPlayContextmethod to restore shuffle mode after play is started. Some players (e.g. HA SpotifyConnect AddOn, librespot, etc) reset the shuffle setting when starting context play.
[ 1.0.240 ] - 2025/09/13
- Updated
SpotifyClientPlayerMediaPlayTracksandPlayerMediaPlayContextmethods to check if player is active and not restricted prior to setting shuffle mode. This should correct theRestriction violatederrors when calling these methods.
[ 1.0.239 ] - 2025/08/30
- Updated
SpotifyClient.PlayerMediaPlayTrackFavoritesmethod to activate the specified (or default) device if it not currently active. This will correct the404 - Device not founderror if the device is not currently active.
[ 1.0.238 ] - 2025/08/24
- Added support for
go-librespotclients.
[ 1.0.237 ] - 2025/08/18
- Added model
PlayerLastPlayedInfo. Contains information about the content that was last playing on the Spotify Player, including context, item (track / episode), progress, and active device. This is a helper object, and is not part of the Spotify Web API specification. - Added property
SpotifyClient.PlayerLastPlayedInfo; Contains information about the content that was last playing on the Spotify Player. This property is updated when calls are made to theGetDevicePlaybackStateandGetPlayerPlaybackStatemethods. - Updated method
SpotifyClient.PlayerMediaPlayContextto fixMalformed JSONerrors that would occur if thepositionMSargument was used. - Updated method
SpotifyClient.PlayerTransferPlaybackto utilize the newPlayerLastPlayedInfoclass to resume play when there is no active device. The track favorites will be used if there is no last played information set.
[ 1.0.236 ] - 2025/08/10
- Changed the
SpotifyClient.PlayerMediaPlayTrackFavoritesmethod to default the shuffle argument tonull. Specify the following for theshuffleargument: True to set player shuffle mode to on; False to set player shuffle mode to off; null to leave the shuffle mode as-is. Default is null. - Added Google Cast
MultiZoneListenersupport to better determine cast group leadership status.
[ 1.0.235 ] - 2025/08/04
- Updated the following
SpotifyClientmethods to support Spotify Track Re-Linking functionality:GetPlayerPlaybackState,GetPlayerNowPlaying. Prior to this fix, the calls were not returninglinked_fromresults.
[ 1.0.234 ] - 2025/08/02
- Updated the following
SpotifyClientmethods to support Spotify Track Re-Linking functionality:GetAlbum,GetAlbums,GetAlbumTracks,GetPlaylistItems,GetTrack,GetTracks,GetTrackFavorites. - Added model
LinkedFrom. Part of the response when Track Relinking is applied, and the requested track has been replaced with different track. The track in thelinked_fromobject contains information about the originally requested track. - Added
TrackSimplified.IdOriginproperty that contains the origin Spotify ID for the track. TheLinkedFrom.Idvalue is returned if present; otherwise, theIdvalue is returned. This is a helper property, and is not part of the Spotify Web API specification. - Added
TrackSimplified.UriOriginproperty that contains the origin Spotify URI for the track. TheLinkedFrom.Urivalue is returned if present; otherwise, theUrivalue is returned. This is a helper property, and is not part of the Spotify Web API specification. - Added
TrackSimplified.IsLinkedFromproperty that determines whether or not the track is linked from another track (True) or not (False). This is a helper property, and is not part of the Spotify Web API specification. - Added
TrackSimplified.LinkedFromproperty that is part of the response when Track Relinking is applied, and the requested track has been replaced with a different track. The track in the LinkedFrom object contains information about the originally requested track.
[ 1.0.233 ] - 2025/07/27
- Updated package requirement from
smartinspectpython>=3.0.37tosmartinspectpython>=3.0.38. - Rebuilt package due to PDoc build error.
[ 1.0.232 ] - 2025/07/27
- Updated package requirement from
smartinspectpython>=3.0.37tosmartinspectpython>=3.0.38.
[ 1.0.231 ] - 2025/07/25
- Updated internal code to utilize Spotify media types enumeration (
SpotifyMediaTypes).
[ 1.0.230 ] - 2025/07/25
- Added
SpotifyMediaTypesclass; Spotify media types enumeration.
[ 1.0.229 ] - 2025/07/24
- Added
SpotifyClient.Searchmethod; Get Spotify catalog information about albums, artists, playlists, tracks, shows, episodes or audiobooks that match a keyword string. This allows you to search ALL criteria types with one call, but only supports auto-pagination. Use the individual search type methods if you want to employ pagination techniques for searching.
[ 1.0.228 ] - 2025/07/23
- Updated Google Cast processing to transfer control to the deviceId that was activated, as well as send other player commands to the activated device. The actual deviceId that was activated may be different than the requested deviceId. This can sometimes occur when activating a group, as getInfoResponse will return the deviceId of the group coordinator instead of the deviceId of the group itself.
[ 1.0.227 ] - 2025/07/22
- Updated Google Cast processing to transfer control to the deviceId that was activated. The actual deviceId that was activated may be different than the requested deviceId. This can sometimes occur when activating a group, as getInfoResponse will return the deviceId of the group coordinator instead of the deviceId of the group itself.
[ 1.0.226 ] - 2025/07/19
- Updated Google Cast zeroconf message processing to ignore IP address changes for cast group notifications; we want the first device discovered in the group to be the coordinator by default.
[ 1.0.225 ] - 2025/07/18
- Updated
SpotifyConnectDirectoryTask.ActivateCastAppSpotifymethod to use the discovery result ip address (instead of the host address from the multi-zone status result). The multi-zone status results were returning IPV6 formatted addresses, which was causing issues if the device was originally activated using an IPV4 address!
[ 1.0.224 ] - 2025/07/18
- Added support for
interactionIDsargument in various Google Cast message payloads. - Added support for
hashedUserNameargument in Google CastaddUsermessage payloads.
[ 1.0.223 ] - 2025/07/12
- Added
SpotifyClient.IsSpotifyUrimethod to determine if a value is a Spotify URI (true) or not (false). - Updated
SpotifyClient.PlayerMediaPlayContextmethod to improve shuffle functionality.
[ 1.0.222 ] - 2025/07/02
- Updated requirements: from
urllib3>=1.21.1,<1.27tourllib3>=2.0. Due to Home Assistant Core 2025.7.0 update requirements.
[ 1.0.221 ] - 2025/06/28
- Updated
SpotifyConnectZeroconfCastListener._GetZeroconfDiscoveryResultmethod to remove IPV4 host resolution, as both IPV4 and IPV6 are supported types for casting. Theget_multizone_statuscall will only return IPV6 information in some instances anyway. - Updated
SpotifyConnectDirectoryTask.ActivateCastAppSpotifymethod to increase wait times for cast objects to become available. More time is needed for cast group processing. - Updated calls made to
SpotifyConnectDeviceNotFoundto include thelogsi=parameter, so that trace dumps are not generated in the system logger.
[ 1.0.220 ] - 2025/06/26
- Updated requirements: restored
urllib3>=1.21.1,<1.27fromurllib3>=2.0due to Home Assistant issues.
[ 1.0.219 ] - 2025/06/25
- Updated
SpotifyConnectZeroconfCastController.launch_appmethod to add a slight delay before we query the Spotify Cast App for Spotify Connect device information. This should allow time for devices whose group leader has changed to promote the change throughout the group membership, so the group leader contains the correct getInfo response. - Updated requirements: from
urllib3>=1.21.1,<1.27tourllib3>=2.0. Due to HA core 2025.07.00 update requirements.
[ 1.0.218 ] - 2025/06/24
- Updated
SpotifyConnectDirectoryTask.ActivateCastAppSpotifymethod to ensure that the SpotifyAppTask is activated on the group leader if the device name is a cast group.
[ 1.0.217 ] - 2025/06/23
- Updated underlying
PyChromecastpackage requirement from version>=14.0.5to>=14.0.7. - Updated
SpotifyConnectZeroconfCastController.GetInformationmethod to back out the CastgetInfo.deviceAPI_isGroupparameter changes from v1.0.216. This seems to have caused more issues than it prevents.
[ 1.0.216 ] - 2025/06/21
- Updated
SpotifyConnectZeroconfCastController.GetInformationmethod to properly set the CastgetInfo.deviceAPI_isGroupparameter, which indicates if the remote device is part of a group or not.
[ 1.0.215 ] - 2025/06/20
- Updated
SpotifyConnectDirectoryTask.OnServiceInfoAddedUpdatedChromecastmethod to discover Google Cast devices in the device collection by their discovery KEY (e.g. UUID) value rather than their NAME value. The discovery name value cannot be used, as Google Group updates use slightly different names that refer to the same key value! This was causing duplicate group names to be added to the devices collection, as well as host ip address and port details to be wrong which prevented devices from being activated in the group.
[ 1.0.214 ] - 2025/06/19
- Updated
SpotifyConnectDirectoryTask.UpdatePlayerDevicesmethod to check each entry in the Spotify Web API device list for alias indicators. If a Spotify Web API device entry is an alias, then the device id and device name values will be the same (e.g. a device id value) and the SpotifyConnectDevices collection entry's DeviceInfo.RemoteName value will be an empty string (e.g. ""). If so then we don't want to update the RemoteName value, as an alias is in use; if not, then the RemoteName was changed and we need to update the device collection. - Updated
SpotifyConnectZeroconfCastListener._GetZeroconfDiscoveryResultmethod to retrieve IPV4 host information if necessary. The CastInfo object will sometimes contain IPV6 data in the base object; if found, then the CastInfo.services array must be iterated to find the IPV4 HostServiceInfo record that will contain IPV4 address format. IPV4 is preferred over IPV6.
[ 1.0.213 ] - 2025/06/19
- Rebuilt, as v1.0.212 did not contain documentation updates.
[ 1.0.212 ] - 2025/06/19
- Updated
SpotifyConnectDirectoryTask.OnServiceInfoAddedUpdatedSpotifyConnectmethod to handle Spotify Connect Zeroconf device name changes.
[ 1.0.211 ] - 2025/06/19
- Updated
SpotifyConnectDevices.GetDeviceByNameAndIddevice resolution processing to correct a bug that was causing Google Cast Group devices to not be detected.
[ 1.0.210 ] - 2025/06/18
- Updated
SpotifyConnectDevices.GetDeviceByIddevice resolution processing. All Spotify Connect Zeroconf GetInfo responseDeviceIdentries are checked first; if not resolved, then base deviceIdentries are checked. We do it this way in case a Spotify Connect Zeroconf GetInfo response has not been recevied for a device yet. - Updated
SpotifyConnectDevices.GetDeviceByNamedevice resolution processing. All Spotify Connect Zeroconf GetInfo responseRemoteName/ Zeroconf DiscoveryResultDeviceNameentries are checked first; if not resolved, then Spotify Connect Zeroconf GetInfoAliasentries are checked. We do it this way in case an alias name is defined for a Spotify Connect Zeroconf entry that already exists with the same name (e.g. the RemoteName entry will take precedence). - Added additional tracing messages for diagnosing device resolution / connection issues.
[ 1.0.209 ] - 2025/06/17
- Updated
SpotifyClient.PlayerMediaPlayContextmethod, adding theshuffleargument: True to enable player shuffle mode; False to disable player shuffle mode; None to use current player shuffle mode. Default is None. - Updated
SpotifyClient.PlayerMediaPlayTracksmethod, adding theshuffleargument: True to enable player shuffle mode; False to disable player shuffle mode; None to use current player shuffle mode. Default is None.
[ 1.0.208 ] - 2025/06/14
- Updated
SpotifyConnectDirectoryTaskto handle Google Cast device rename changes. - Updated
SpotifyConnectDirectoryTaskto properly handle Google Cast Groupadd_castnotifications. There should only be 1 instance of the Group Name registered in the SpotifyConnectDevices collection. The issue was that the Cast protocol generates anadd_castoperation for each member of the group and the code was processing eachadd_castentry as a new device entry.
[ 1.0.207 ] - 2025/05/12
- Updated
SpotifyConnectZeroconfCastAppTasklogic to use the Spotify Desktop Player OAuth2 token to activate Google Chromecast devices. This was necessary due to changes made by Spotify to disable Spotify Web Player Cookie credential access token usage with their Spotify Web API.
[ 1.0.206 ] - 2025/05/08
- Added logic to transfer playback corectly for Sonos devices after Spotify API changes that broke functionaity.
[ 1.0.205 ] - 2025/05/08
- Updated
SpotifyClientmethods to change the default Spotify Developer App Redirect URL to comply with Spotify guidance; value was changed fromlocalhostto127.0.0.1. More information can be found on the Spotify Developer Forum Blog post that was conveyed on February 12, 2025.
[ 1.0.204 ] - 2025/05/04
- Updated
SpotifyClientmethods to return an exception due to the functions being removed by the Spotify development team (without warning, as usual). More information can be found on the Spotify Developer Forum Blog post that was conveyed on November 27, 2024. The following methods will now raise aSpotifyApiErrorexception due to the Spotify development team changes:GetTrackRecommendations,GetGenres. - Updated
SpotifyClient.GetPlaylistFavoritesmethod to not use the Spotify Web Player Credentials, as it was returning a404 Not Found. It seems that the Spotify developers disabled the extended functionality, so that any "Made For You" playlists cannot be returned in the results. User-defined playlist favorites will be returned as normal.
[ 1.0.203 ] - 2025/04/28
- Fixed a bug that was causing Sonos devices to transfer playback after a 5 second delay. Delay can be removed if using Spotify Web Player Credentials for control.
[ 1.0.202 ] - 2025/04/27
- Corrected logic to resolve device object by device name when there are duplicate names defined to the device list.
[ 1.0.201 ] - 2025/04/26
- Added logic to resolve device object by device name when there are duplicate names defined to the device list. If the resolved device name is the same as the active device name, but the id's are different, then the active device is used instead of the resolved device.
- Updated
SpotifyConnectDirectoryTask.ActivateCastAppSpotifyto search for device by id first; if no matches, then search for device by name.
[ 1.0.200 ] - 2025/04/23
- Added logic to detect device name changes when speakers are grouped / ungrouped. This can happen for devices that are added to / removed from groups and do not correctly inform interested parties via a zeroconf OnServiceStateChange event that the name has changed (e.g. Denon HEOS devices, etc).
[ 1.0.199 ] - 2025/04/07
- Updated
ImageVibrantColorsmodel to include the rgb, hsl, and population values along with the rgb_hex values.
[ 1.0.198 ] - 2025/04/06
- Changed
pillow>=11.1.0requirement topillow>=10.3.0for older versions of Home Assistant that have apillow>=10.3.0requirement.
[ 1.0.197 ] - 2025/04/06
- Removed version 1.0.196, as the
vibrant-pythonnamespace has a dependency that was not compatible with current version of Home Assistant: "pillow>=10.1.0,<11.0.0". - Added namespace
vibrantto library to support vibrant color extraction.
[ 1.0.196 ] - 2025/04/06
- Added
ImageVibrantColorsmodel that contains vibrant colors extracted from a processed image. - Added
SpotifyClient.GetImageVibrantColorsmethod that extracts vibrant color palette RGB values from the specified image url.
[ 1.0.195 ] - 2025/04/03
- Changed transfer playback behavior to resume playback of the last playing track instead of defaulting to playing of track favorites if no active device was found and Spotify Web Player cookie credentials are in use. Note that track favorites will be used if no active device was found and Spotify Web Player cookie credentials are NOT in use.
[ 1.0.194 ] - 2025/03/29
- Added support for re-awakening Amazon devices from sleep mode.
[ 1.0.193 ] - 2025/03/27
- Updated underlying
smartinspectpythonpackage requirement to version 3.0.37.
[ 1.0.192 ] - 2025/03/26
- Updated underlying
smartinspectpythonpackage requirement to version 3.0.36.
[ 1.0.191 ] - 2025/03/19
- Added Time-based One Time Password processing.
- Added
pyotppackage requirement version >=2.9.0.
[ 1.0.190 ] - 2025/03/14
- Fixed a bug that was causing
'ZeroconfGetInfoAlias' object has no attribute 'lower'exceptions when Aliases were returned in Spotify ConnectGetInforequests.
[ 1.0.189 ] - 2025/03/13
- Fixed a bug that was causing the device name to be blank when Aliases were returned in Spotify Connect
GetInforequests. The first alias name will be used as the device name when aliases are returned for a device. - Defaulted Chromecast Zeroconf GetInformation BrandDisplayName value to "ChromeCast" if a manufacturer name was not supplied.
[ 1.0.188 ] - 2025/03/09
- Added more device
cast_typevalues to check for supported Chromecast devices:null; ifcast_typeis null, then assume it supports audio. It appears that some manufacturers are not correctly setting this attribute (e.g. LG SN Series ThinQ Soundbar, JBL Authentics 200, etc).
[ 1.0.187 ] - 2025/03/08
- Cleaned up some error / trace messages related to Spotify Web Player credentials processing.
[ 1.0.186 ] - 2025/03/08
- Fixed a bug in Spotify Web Player credentials processing.
[ 1.0.185 ] - 2025/03/08
- Fixed a bug in device name processing to properly display the Spotify Connect RemoteName value. Prior code was causing the Zeroconf DeviceName to be displayed, which is sometimes not a user-friendly name.
- Added Spotify Web Player credentials to
SpotifyClientclass constructor. If thespotifyWebPlayerCookieSpdcandspotifyWebPlayerCookieSpkeyargument values are specified, then an "elevated" access token (created from the argument values) will be used for all player-control related methods.
[ 1.0.184 ] - 2025/03/02
- Updated underlying
smartinspectpythonpackage requirement to version 3.0.35.
[ 1.0.183 ] - 2025/03/02
- Updated PDoc Documentation package name to lower-case, to match the PyPi.org package name. This was to adhere to PyPI.org requirements for uploaded binary distribution filenames to comply with the binary distribution format.
[ 1.0.182 ] - 2025/03/02
- Updated
setup.pyto adhere to PyPI.org requirements for uploaded binary distribution filenames to comply with the binary distribution format. This changes the wheel filename that is generated fromspotifywebapiPython-1.0.182-py3-none-any.whltospotifywebapipython-1.0.182-py3-none-any.whl(same filename, just lower-case project name).
[ 1.0.181 ] - 2025/03/01
- Updated logic to start / restart the Spotify Connect Directory task only if the authorization token setup was successful. Prior logic was causing a misleading exception to be returned to the caller, and the original offending exception was only visible in the SmartInspect trace.
[ 1.0.180 ] - 2025/02/25
- Updated Spotify Web API request logic to retry request failures with status code 504 (Gateway Timeout); request will be tried 5 times with a slight delay in between before giving up.
- Updated Spotify Web Player token refresh request logic to retry request failures with status code 504 (Gateway Timeout); request will be tried 5 times with a slight delay in between before giving up.
[ 1.0.179 ] - 2025/02/25
- Updated
SpotifyClient.GetDevicePlaybackStatemethod to get the current Spotify playback state, with device fallback if nothing is reported from Spotify. - Updated
SpotifyClient.PlayerTransferPlaybackmethod to ignore exceptions if trying to pause play on the device being transferred from.
[ 1.0.178 ] - 2025/02/24
- Updated
mediaPositionHMS_toSecondsmethod to account for a null position value.
[ 1.0.177 ] - 2025/02/24
- Added retry logic to token exchange method for handling Spotify Web Player token refresh "504 - Gateway Timeout" errors.
- Added exception handling logic to process TokenError exceptions more gradefully and without adding extra system log errors messages.
[ 1.0.176 ] - 2025/02/24
- Added Spotify Player transport control for Spotify FREE accounts. Note that the Spotify Web Player Authentication Setup must be configured to use this functionality; if not configured, then the Spotify Web API will return a
Premium requiredexception for all transport control methods.
[ 1.0.175 ] - 2025/02/23
- Updated
SpotifyClientmethods to utilize the Spotify Web Player elevated access token (if configured) if a Spotify Player method is accessed. This should prevent issues with Sonos devices. Note that the Spotify Web Player Authentication Setup must be configured to use this functionality; if not configured, then the Sonos Controller (e.g. SoCo) API is used to control the Sonos device. The following methods were updated:PlayerMediaPause,PlayerMediaResume,PlayerMediaSeek,PlayerMediaSkipNext,PlayerMediaSkipPrevious,PlayerSetRepeatMode,PlayerSetShuffleMode,PlayerSetVolume,PlayerTransferPlayback,AddPlayerQueueItems.
[ 1.0.174 ] - 2025/02/22
- Updated
SpotifyClientmethods to restore functions that were previously deprecated by the Spotify development team. Note that the Spotify Web Player Authentication Setup must be enabled to use these specific functions; if not enabled, the functions will still work but won't return Spotify owned items and data. The following methods have functionality restored:GetPlaylistItems.
[ 1.0.173 ] - 2025/02/22
- Updated
SpotifyClientmethods to restore functions that were previously deprecated by the Spotify development team. Note that the Spotify Web Player Authentication Setup must be enabled to use these specific functions; if not enabled, the functions will still work but won't return Spotify owned items and data. The following methods have functionality restored:GetPlaylist,GetPlaylistFavorites.
[ 1.0.172 ] - 2025/02/22
- Updated
SpotifyClientmethods to restore functions that were previously deprecated by the Spotify development team. Note that the Spotify Web Player Authentication Setup must be enabled to use these specific functions; if not enabled, the functions will raise adeprecatedexception. The following methods were restored:GetArtistRelatedArtists,GetTrackRecommendations,GetTracksAudioFeatures,GetFeaturedPlaylists,GetCategoryPlaylists,GetGenres.
[ 1.0.171 ] - 2025/02/21
- Updated
SpotifyConnectDirectoryTask.GetSonosPlayermethod to trace the SoCo instance that is used to control Sonos devices.
[ 1.0.170 ] - 2025/02/20
- Updated
SpotifyConnectDevices.GetDeviceByNamemethod to match on alias name, remote name, and zeroconf device name when resolving a device name value. - Updated
SpotifyConnectDirectoryTask.OnServiceInfoAddedUpdatedSpotifyConnectmethod to use the ZeroConf DeviceName value for the user-friendly device name by default. The getInfo RemoteName value will be used for the user-friendly device name for some manufacturers (Sonos, etc).
[ 1.0.169 ] - 2025/02/20
- Updated
SpotifyConnectDirectoryTask.GetSonosPlayermethod to optionally return the Sonos Group Coordinator when retrieving the Sonos Controller instance for a device. This should prevent any"play" can only be called/used on the coordinator in a grouperrors.
[ 1.0.168 ] - 2025/02/18
- Cleaned up some old trace messages and code comments.
[ 1.0.167 ] - 2025/02/18
- Updated
SpotifyConnectDirectoryTask.GetDevicesmethod to not lock the collection when making a copy of the collection.
[ 1.0.166 ] - 2025/02/18
- Updated
AuthClient.RefreshTokenlogic to prevent calling external token updaters from more than 1 thread at a time.
[ 1.0.165 ] - 2025/02/17
- Updated
SpotifyClient.PlayerMediaPlayContextandPlayerMediaPlayTracksto utilize Spotify Web Player authorization token when starting play for Sonos and restricted devices. This will cause play to start under Spotify Connect control, rather than using the Sonos Local Queue. Refer to the Spotify Web Player Authentication Setup wiki page for more information on how to configure it.
[ 1.0.164 ] - 2025/02/05
- Added
SpotifyClient.Disposemethod to properly dispose of resources and unwire events when the instance is destroyed.friendly.
[ 1.0.163 ] - 2025/01/30
- Adjusted
no active deviceerror message to be more user-friendly. - Updated service method arguments to indicate DEPRECATED parameters (e.g. parameters no longer used).
[ 1.0.162 ] - 2025/01/28
- Added device
cast_typevalue toZeroconfDiscoveryResult.Propertiesfor easier detection of Chromecast device types. - Updated
SpotifyClient.PlayerMediaPlayContextmethod to correct shuffled track behavior; Prior behavior did not honor the current shuffle setting of the player, and would always start with the first track.
[ 1.0.161 ] - 2025/01/26
- Added more device
cast_typevalues to check for supported Chromecast devices:cast,group.
[ 1.0.160 ] - 2025/01/26
- Removed check for
(castInfo.cast_type != "audio")to determine if the Chromecast device is allowed in the device list or not. This was never released to PROD.
[ 1.0.159 ] - 2025/01/25
- Replaced
threading.Lockreferences withthreading.RLock(reentrant) references. This should avoid any potential deadlock situations for recursive calls to methods on the same thread.
[ 1.0.158 ] - 2025/01/23
- Updated Chromecast logic to support more user-friendly error messages when configuration / initialization errors occur.
[ 1.0.157 ] - 2025/01/23
- Updated Chromecast logic to support more user-friendly error messages when configuration / initialization errors occur.
[ 1.0.156 ] - 2025/01/23
- Updated
SpotifyClientmethods that require adeviceIdargument to check for a "Device Not Found" condition, and return a more user-friendly message than the "Device Not Found" message from the Spotify Web API.
[ 1.0.155 ] - 2025/01/22
- Updated
SpotifyClient.AddPlayerQueueItemsto support adding items to the Sonos device local queue. - Added
additionalTypes='episode'parameter to allGetPlayerPlaybackState()calls so that context and item information is returned in the player playstate data.
[ 1.0.154 ] - 2025/01/22
- Updated function
SpotifyClient.PlayerMediaPlayTracksto handle playing tracks on the Sonos local queue. Sonos devices can only initiate play (of tracks or context) on their local queue, as they are considered restricted devices by the Spotify Web API. - Updated function
SpotifyClient.PlayerMediaPlayContextto handle playing context on the Sonos local queue. Sonos devices can only initiate play (of tracks or context) on their local queue, as they are considered restricted devices by the Spotify Web API.
[ 1.0.153 ] - 2025/01/22
- Updated function
SpotifyClient.PlayerTransferPlaybackto return aSpotifyConnectDeviceobject for the device where playback was transferred to.
[ 1.0.152 ] - 2025/01/22
- Added more support for Sonos Player functions via the SoCo Sonos API.
[ 1.0.151 ] - 2025/01/21
- Added support for limited Sonos Player functions via the SoCo Sonos API.
- Added
socopackage requirement, >= 0.30.6.
[ 1.0.150 ] - 2025/01/20
- Updated
SpotifyConnectDirectoryTaskto reset Zeroconf response data after Chromecast device activation; new requests were still referring to the stale information.
[ 1.0.149 ] - 2025/01/20
- Added support for Google Chromecast Spotify Connect devices.
- Added namespace
spotifyconnectthat contains support for Spotify Connect device discovery. - Removed function
SpotifyClient.AddPlayerQueueItem- useAddPlayerQueueItemsinstead. - Removed function
SpotifyClient.PlayerActivateDevices- playback is auto-transferred to some devices when they are activated (Sonos, Chromecast, etc). This method is no longer needed, as devices are automatically resolved / activated now. - Removed function
SpotifyClient.PlayerVerifyDeviceDefault- devices are automatically resolved / verified now. - Removed function
SpotifyClient.VerifyPlayerActiveDeviceId- devices are automatically resolved / verified now. - Added
PyChromecastpackage requirement, >= 14.0.5. - Updated underlying
smartinspectPythonpackage requirement to version 3.0.34. - Updated Python from v3.9 to v3.11.
- Updated minimum python version requirement from v3.5.1+ to v3.11.0+
[ 1.0.148 ] - 2025/01/13
- Updated trace message to better reflect logic flow.
[ 1.0.147 ] - 2025/01/13
- Added
SpotifyConnectDevices.UpdateActiveDevicemethod to update the currently active device based on playerState. - Added
ZeroconfDiscoveryResult.Descriptionproperty that returns a basic description of the device, and how source info was obtained. This is a helper property, and not part of the Zeroconf ServiceInfo result.
[ 1.0.146 ] - 2025/01/12
- Added
SpotifyConnectDevices.RemoveDevicemethod to remove existing device entry(s) from theItemscollection by device id value.
[ 1.0.145 ] - 2025/01/12
- Added
SpotifyConnectDevices.GetActiveDevicemethod to return a Spotify Connect device if one is currently marked as the active device; otherwise, null if there is no active device. - Updated
SpotifyConnectDevices.UpdatePlayerDevicesmethod to return the currently active Spotify Player device instance as determined by the Spotify Player PlayState if one was supplied; otherwise, null if not active device.
[ 1.0.144 ] - 2025/01/10
- Added
SpotifyConnectDevices.UpdatePlayerDevicesmethod to add a list of dynamic player device entries to theItemscollection, remove any existing dynamic devices from the collection that are not in theplayerDeviceslist, and update the currently active device based on playerState.
[ 1.0.143 ] - 2025/01/10
- Added
SpotifyConnectDevices.GetDeviceIndexByDiscoveryNamemethod to return the index of theItemscollection entry that contains the specified device Zeroconf discovery results name value, or -1 if not found.
[ 1.0.142 ] - 2025/01/10
- Added
ZeroconfDiscoveryResult.Equalsmethod to compare object argument values to determine equality. - Added
ZeroconfGetInfo.Equalsmethod to compare object argument values to determine equality. - Added
SpotifyConnectDevice.Equalsmethod to compare object argument values to determine equality.
[ 1.0.141 ] - 2025/01/09
- Added
SpotifyConnectDevices.GetDeviceByDiscoveryKeymethod to return the device of theItemscollection entry that contains the specified device Zeroconf discovery results key value, or null if not found.
[ 1.0.140 ] - 2025/01/09
- Added
SpotifyConnectDevices.GetDeviceIndexByDiscoveryKeymethod to return the index of theItemscollection entry that contains the specified device Zeroconf discovery results key value, or -1 if not found.
[ 1.0.139 ] - 2025/01/07
- Updated
SpotifyDiscovery._OnServiceStateChangemethod to correctly update the Zeroconf DiscoveryResults instance. The serviceinfoKeyvalue must be used to update the device entry (not itsIdvalue).
[ 1.0.138 ] - 2025/01/06
- Updated
SpotifyDiscovery._OnServiceStateChangemethod to correctly update the Zeroconf DiscoveryResults instance.
[ 1.0.137 ] - 2025/01/06
- Added
PlayerPlayState.IsEmptyproperty setter.
[ 1.0.136 ] - 2025/01/05
- Updated
SpotifyClient.PlayerTransferPlaybackmethod to check player state before trying to transfer playback. If nothing is playing, then issue a call toPlayTrackFavoritesinstead. This will avoid theRestriction violatederror which results from a transfer playback to the player when nothing is currently playing.
[ 1.0.135 ] - 2025/01/05
- Updated
SpotifyClientclass to include properties forSpotifyConnectLoginIdandSpotifyConnectUsername.
[ 1.0.134 ] - 2025/01/04
- Updated
SpotifyClientmethodsPlayerActivateDevicesandGetSpotifyConnectDeviceto re-create the ZeroconfConnect connection instance if the device IP address or port changed after Zeroconf rediscovery on a Disconnect call sequence.
[ 1.0.133 ] - 2025/01/04
- Modified
SpotifyDiscovery._OnServiceStateChangemethod to process Zeroconf Update and Remove notifications.
[ 1.0.132 ] - 2025/01/02
- Modified
ZeroconfConnect.GetInformationmethod logic to automatically retry the connection (after 250ms, 2s max) to the Spotify Connect Zeroconf device service if a "connection refused" was returned while trying to get device information. This was originally set to 10 seconds, which is far too long to wait for a device to become available. - Updated
SpotifyClientmethodsPlayerActivateDevicesandGetSpotifyConnectDeviceto rediscover the Spotify Connect Zeroconf device after a Disconnect call is issued. It has been found that some device manufacturers (e.g. Denon) stop and restart the Zeroconf server on the device after aresetUsers(e.g. disconnect) call is made, which changes the IP Port number that the device listens on for incoming connections. - Removed the deprecated function
SpotifyConnect.PlayerResolveDeviceId(since 2024/08/15); use theGetSpotifyConnectDevicemethod instead.
[ 1.0.131 ] - 2025/01/01
- Modified
ZeroconfConnect.GetInformationmethod logic to automatically retry the connection (after 250ms, 10s max) to the Spotify Connect Zeroconf device service if a "connection refused" was returned while trying to get device information. The previous logic used a simple delay prior to the call and did not retry the connection, which resulted in the "connection refused" exceptions while trying to awaken devices. Some Spotify Connect devices take a little bit longer to start accepting connections again after a change. - Added
lxmlpackage requirement tosetup.py.
[ 1.0.130 ] - 2024/12/27
- Added
PlayerPlayState.IsEmptyproperty; returns True if Spotify playstate returned an empty response; otherwise, false. This is a helper property, and is not part of the Spotify Web API specification.
[ 1.0.129 ] - 2024/12/21
- Added
SpotifyClient.GetCoverImageFilethat gets the contents of an image url and transfers the contents to the local file system. This method should only be used to download images for playlists that contain public domain images. - Added
ImageObject.GetImageHighestResolutionWidththat returns the highest resolution order image width from a list ofImageObjectitems.
[ 1.0.128 ] - 2024/12/20
- Updated
PlayerActionsmodel to load the correct action values forTogglingRepeatTrackandTogglingShuffle. These were switched, which was causing shuffle and repeat actions to be misinterpreted.
[ 1.0.127 ] - 2024/12/19
- Updated
SpotifyClient.PlayerMediaPlayTrackFavoritesto default and validate limitTotal argument. It has been found that approximately 750 items can be retrieved and played successfully (anything more generates request size errors).
[ 1.0.126 ] - 2024/12/18
- Updated
SpotifyClient.PlayerMediaPlayTrackFavoritesto retrieve unsorted track favorites, so that the most recently added favorites are played instead of the first alphabetical favorites.
[ 1.0.125 ] - 2024/12/09
- Added
PlaylistSimplifiedproperty setters for the the following properties:Description,Id,Name,Type,Uri.
[ 1.0.124 ] - 2024/12/07
- Updated various
SpotifyClientmethods to discard favorites that do not contain a valid URI value. Sometimes the Spotify Web API returns favorite items with no information! The following methods were updated:GetAlbumFavorites,GetEpisodeFavorites,GetShowFavorites,GetTrackFavorites.
[ 1.0.123 ] - 2024/12/06
- Updated various methods to validate boolean arguments - if value was not passed (e.g. None), then set to documented value (True or False).
- Fixed a bug in
SpotifyClient.PlayerTransferPlaybackmethod that was causing play not to resume ifPlay=TrueandforceActivateDevice=True. If forceActivateDevice=True, then we need to resume play manually if play=True was specified; this is due to the device losing its current status since it was being forcefully activated (e.g. disconnected and reconnected).
[ 1.0.122 ] - 2024/12/02
- Updated
SpotifyClientmethods to return an exception due to the functions being deprecated by the Spotify development team. More information can be found on the Spotify Developer Forum Blog post that was conveyed on November 27, 2024. The following methods will now raise aSpotifyApiErrorexception due to the Spotify development team changes:GetArtistRelatedArtists,GetTrackRecommendations,GetTracksAudioFeatures,GetFeaturedPlaylists,GetCategoryPlaylists,GetGenres. The following properties were also marked as deprecated for the same reason:TrackSimplified.PreviewUrl. - Due to the above changes made by Spotify, any Algorithmic and Spotify-owned editorial playlists are no longer accessible or have more limited functionality. This means that you can no longer obtain details via the
SpotifyClient.GetPlaylistandSpotifyClient.GetPlaylistItemsmethods for Spotify-owned / generated content (e.g. "Made For You", etc). A404 - Not Founderror will be returned when trying to retrieve information for these playlist types.
[ 1.0.121 ] - 2024/11/20
- Updated
AuthTokenGenerator.pysample code to correctly reference the token cache file.
[ 1.0.120 ] - 2024/11/18
- Updated
SpotifyClient.ReorderPlaylistItemsto validate required input parameters were supplied. - Updated
SpotifyClient.ReplacePlaylistItemsto check for no uris argument; this can occur if you want to clear the playlist. - Updated
SpotifyClient.GetPlaylistCoverImagemethod to make theplaylistIdargument optional; if not supplied, the currently playing playlist id value is used instead. - Added
SpotifyClient.Versionproperty.
[ 1.0.119 ] - 2024/11/15
- Updated
TrackRecommendationsmodel to return empty arrays (instead of None) if seeds or tracks items were not found.
[ 1.0.118 ] - 2024/11/07
- Updated
SpotifyClient.GetArtistInfomethod to handle thesee moresuffix in theBioHtmlproperty. - Updated
SpotifyClient.GetArtistInfomethod to correctly parse tour event dates.
[ 1.0.117 ] - 2024/11/07
- Updated
SpotifyClient.GetArtistInfomethod to force all links in theBioHtmlproperty to open in a new browser window / tab (e.g. addedtarget="_blank").
[ 1.0.116 ] - 2024/11/07
- Updated
ArtistInfoTourEventmodel to include the concert link. - Fixed
SpotifyClient.GetArtistInfomethod to correctly parse Spotify artist info and tour events.
[ 1.0.115 ] - 2024/11/04
- Updated
PlayerQueueInfomodel to include theDateLastRefreshedproperty, which contains the date and time items were was last refreshed in unix epoch format (e.g. 1669123919.331225). A value of zero indicates the date was unknown. Note that this attribute does not exist in the Spotify Web API; it was added here for convenience. - Updated
Categorymodel to include theTypeproperty, which contains a simulated data type. This is a helper property - no value with this name is returned from the Spotify Web API. - Updated
Categorymodel to add theuriandtypevalues to data returned by theToDictionarymethod.
[ 1.0.114 ] - 2024/11/03
- Added
sortResultargument to the followingSpotifyClientmethods:GetArtistRelatedArtists,GetArtistTopTracks. If True (default), result items are sorted by name prior to returning to the caller; otherwise, results are left in the order that the Spotify Web API returned them.
[ 1.0.113 ] - 2024/10/30
- Updated
PlayerQueueInfomodel to remove repeated items when retrieving player queue information. For some reason, the Spotify Web API will return up to 10 duplicate items with the same information. For example: if there is only 1 item in the queue, then 10 duplicate items are returned by the Spotify Web API; if there are 5 items in the queue, then 5 duplicate items are returned by the Spotify Web API. We will check for this scenario, and only return non-duplicate items if so. - Updated
PageObjectmodel to include theDateLastRefreshedproperty, which contains the date and time items were was last refreshed in unix epoch format (e.g. 1669123919.331225). A value of zero indicates the date was unknown. Note that this attribute does not exist in the Spotify Web API; it was added here for convenience. - Added
SpotifyClient.AddPlayerQueueItemsmethod that will add one or more items to the end of the user's current playback queue. - Marked
SpotifyClient.AddPlayerQueueItemmethod as deprecated; use the newAddPlayerQueueItemsmethod instead.
[ 1.0.112 ] - 2024/10/19
- Updated
SpotifyClient.GetSpotifyConnectDevicemethod to issue a slight delay after disconnecting the device. This should preventGetinformationexceptions for devices that require a little bit of extra time after a Disconnect (e.g. zeroconfresetUsers) request in order to be ready for a Connect (e.g. zeroconfaddUser) request.
[ 1.0.111 ] - 2024/10/14
- Updated
SpotifyClient.GetChaptermethod to make thechapterIdargument optional; if not supplied, the currently playing chapter id value is used instead.
[ 1.0.110 ] - 2024/10/10
- Updated
ImageObject.GetImageHighestResolutionmethod to account for null width values.
[ 1.0.109 ] - 2024/10/10
- Correctly Updated various methods that return an ImageUrl property to return the highest resolution image from the Images collection instead of the first image. For some reason, the Spotify Web API sets the first Images collection image to the lowest resolution (e.g. 64x64); for all other Images, the highest resolution image is listed first (e.g. 640x640).
[ 1.0.108 ] - 2024/10/10
- Updated various methods that return an ImageUrl property to return the highest resolution image from the Images collection instead of the first image. For some reason, the Spotify Web API sets the first Images collection image to the lowest resolution (e.g. 64x64); for all other Images, the highest resolution image is listed first (e.g. 640x640).
[ 1.0.107 ] - 2024/10/09
- Updated
SpotifyClient.RemoveShowFavoritesmethod to account for Spotify Web API changes to remove show favorites. - Updated
SpotifyClient.SaveShowFavoritesmethod to account for Spotify Web API changes to save show favorites. - Updated
SpotifyClient.CheckPlaylistFollowersmethod to account for Spotify Web API changes touserIdsargument, which is now deprecated. A single item list containing current user's Spotify Username must now be used.
[ 1.0.106 ] - 2024/10/04
- Fixed various python
SyntaxWarning: invalid escape sequence '\ 'warnings that were being generated when code was executed. Something changed with Home Assistant recently that turned these "used to be ignored" warnings into actual warnings that wind up in the HA System Log! This is due to invalid escaped characters in various string comments that are used for documentation purposes (e.g. """ this is a code comment """).
[ 1.0.105 ] - 2024/10/04
- Updated Spotify Connect device processing to only require the userid and password parameters when authenticating to devices that require user and password values. Some devices only require a loginid value (e.g. spotifyd, Spotify Connect AddOn, librespot, Sonos, etc). The user should not have to specify userid and password values if they are not required!
- Cleaned up some documentation, as well as some of the code examples.
[ 1.0.104 ] - 2024/10/03
- Updated
SpotifyClient.PlayerMediaSeekmethod to change theprogressMScheck to<= 0when invoking relative positioning.
[ 1.0.103 ] - 2024/10/03
- Updated
SpotifyClient.PlayerMediaSeekmethod to add relative positioning capability. This allows you to seek ahead / behind by a specifiedrelativePositionMSpositioning amount. ThepositionMSargument must be zero to enable this functionality. Note that the relative position functionality is not defined by the Spotify Web API. The functionality was added to this API to support "skip" seeking.
[ 1.0.102 ] - 2024/09/29
- Updated
SpotifyClient.GetShowFavoritesmethod to only return podcast show items by default. Prior to this fix, it was returning both audiobook and podcast shows. The newexcludeAudiobooksargument allows you to return both audiobook and podcast shows (default returned by Spotify Web API).
[ 1.0.101 ] - 2024/09/28
- Updated
ZeroconfConnect.Connectmethod to load authorization credentials for the Spotify ConnectaddUserblob from acredentials.jsonfile for devices that utilize librespot / spotifyd. Spotify no longer supports uername / password authentication via librespot (always returns "Bad Credentials" exceptions. This allows the librespotcredentials.jsonfile to be copied to the spotifywebapiPython storage folder, and used for calls to the librespotaddUserzeroconf endpoint. - Updated
SpotifyClient.GetSpotifyConnectDeviceandPlayerActivateDevicesmethods to bypass the call to Spotify Connect Zeroconf Disconnect for devices that utilize librespot / spotifyd. librespot does not implement the Spotify Connect ZeroconfresetUsersendpoint, so the request always fails with a 404.
[ 1.0.100 ] - 2024/09/26
- Updated
SpotifyClient.GetSpotifyConnectDevicemethod to force a Spotify Connect Disconnect call to the device ifactivateDeviceargument isTrue. TheverifyUserContextargument is deprecated as well. This was necessary, as Spotify Connect device manufacturers do not use the Spotify Connect Zeroconf InformationActiveUserproperty consistently. - Added
PlayerTransferPlayback.forceActivateDeviceargument that allows you to force activate the Spotify Connect device as part of the transfer of playback.
[ 1.0.99 ] - 2024/09/24
- Added
PlayerPlayState.ItemTypeproperty that denotes the type of episode being played:podcastoraudiobook. This property is only loaded when theSpotifyClientGetPlayerNowPlayingorGetPlayerPlaybackStatemethod is called withadditionalTypes='episode'.
[ 1.0.98 ] - 2024/09/24
- Added
SpotifyClient.IsAudiobookEpisodemethod that returns true if the specified episode id is an audiobook chapter; otherwise, false. This allows you to programatically determine the difference between a podcast / show episode, and an audiobook episode.
[ 1.0.97 ] - 2024/09/20
- Updated
ZeroconfGetInfoAliasto fix a bug related to Spotify Connect devices that define aliases (introduced with v1.0.93). This was causingTypeError: unsupported operand type(s) for &: 'str' and 'tuple'exceptions if a device had aliases defined.
[ 1.0.96 ] - 2024/09/19
- Added defensive code in various parsers to account for the Spotify Web API returning an invalid / incomplete object. This was noticed with the
GetAlbumFavoritesmethod, but also applied to other models that inherited from PageObject.
[ 1.0.95 ] - 2024/09/12
- Added
image_urlattribute value to all models that support aToDictionary()method (some that were previously missed in 1.0.94 release).
[ 1.0.94 ] - 2024/09/12
- Added
image_urlattribute value to all models that support aToDictionary()method. - Miscellaneous documentation updates.
[ 1.0.93 ] - 2024/09/10
- Updated
SpotifyClient.GetAlbumFavoritesmethod to correctly sort results based upon thesortResultargument setting; true to sort by name ascending, false to sort by AddedAt descending. - Updated
SpotifyClient.GetEpisodeFavoritesmethod to correctly sort results based upon thesortResultargument setting; true to sort by name ascending, false to sort by AddedAt descending. - Updated
SpotifyClient.GetShowFavoritesmethod to correctly sort results based upon thesortResultargument setting; true to sort by name ascending, false to sort by AddedAt descending. - Updated
SpotifyClient.GetTrackFavoritesmethod to correctly sort results based upon thesortResultargument setting; true to sort by name ascending, false to sort by AddedAt descending.
[ 1.0.92 ] - 2024/08/23
- Updated
SpotifyClient.FollowPlaylistmethod to make theplaylistIdargument optional; if not supplied, the currently playing playlist id value is used instead. - Updated
SpotifyClient.GetAlbummethod to make thealbumIdargument optional; if not supplied, the currently playing album id value is used instead. - Updated
SpotifyClient.GetAlbumTracksmethod to make thealbumIdargument optional; if not supplied, the currently playing album id value is used instead. - Updated
SpotifyClient.GetArtistmethod to make theartistIdargument optional; if not supplied, the currently playing artist id value is used instead. - Updated
SpotifyClient.GetArtistAlbumsmethod to make theartistIdargument optional; if not supplied, the currently playing artist id value is used instead. - Updated
SpotifyClient.GetArtistInfomethod to make theartistIdargument optional; if not supplied, the currently playing artist id value is used instead. - Updated
SpotifyClient.GetArtistRelatedArtistsmethod to make theartistIdargument optional; if not supplied, the currently playing artist id value is used instead. - Updated
SpotifyClient.GetArtistTopTracksmethod to make theartistIdargument optional; if not supplied, the currently playing artist id value is used instead. - Updated
SpotifyClient.GetAudiobookmethod to make theaudiobookIdargument optional; if not supplied, the currently playing audiobook id value is used instead. - Updated
SpotifyClient.GetAudiobookChaptersmethod to make theaudiobookIdargument optional; if not supplied, the currently playing audiobook id value is used instead. - Updated
SpotifyClient.GetEpisodemethod to make theepisodeIdargument optional; if not supplied, the currently playing episode id value is used instead. - Updated
SpotifyClient.GetPlaylistmethod to make theplaylistIdargument optional; if not supplied, the currently playing playlist id value is used instead. - Updated
SpotifyClient.GetPlaylistItemsmethod to make theplaylistIdargument optional; if not supplied, the currently playing playlist id value is used instead. - Updated
SpotifyClient.GetShowmethod to make theshowIdargument optional; if not supplied, the currently playing show id value is used instead. - Updated
SpotifyClient.GetShowEpisodesmethod to make theshowIdargument optional; if not supplied, the currently playing show id value is used instead. - Updated
SpotifyClient.GetTrackmethod to make thetrackIdargument optional; if not supplied, the currently playing track id value is used instead. - Updated
SpotifyClient.GetTracksAudioFeaturesmethod to make thetrackIdargument optional; if not supplied, the currently playing track id value is used instead. - Updated
SpotifyClient.UnfollowPlaylistmethod to make theplaylistIdargument optional; if not supplied, the currently playing playlist id value is used instead.
[ 1.0.91 ] - 2024/08/22
- Updated
CheckTrackFavorites,RemoveTrackFavorites, andSaveTrackFavoritesmethods to ensure that nowplaying item was a track and not an episode item.
[ 1.0.90 ] - 2024/08/22
- Updated various methods to not log handled exception data as unhandled exceptions.
[ 1.0.89 ] - 2024/08/22
- Updated
SpotifyClient.CheckAlbumFavoritesmethod to make theidsargument optional; if not supplied, the currently playing album id value is used instead. - Updated
SpotifyClient.CheckArtistsFollowingmethod to make theidsargument optional; if not supplied, the currently playing artist id value is used instead. - Updated
SpotifyClient.CheckAudiobookFavoritesmethod to make theidsargument optional; if not supplied, the currently playing audiobook id value is used instead. - Updated
SpotifyClient.CheckEpisodeFavoritesmethod to make theidsargument optional; if not supplied, the currently playing episode id value is used instead. - Updated
SpotifyClient.CheckShowFavoritesmethod to make theidsargument optional; if not supplied, the currently playing show id value is used instead. - Updated
SpotifyClient.CheckTrackFavoritesmethod to make theidsargument optional; if not supplied, the currently playing track id value is used instead.
[ 1.0.88 ] - 2024/08/20
- Updated
SpotifyClient.DefaultDeviceIdproperty to setter to account for empty string values.
[ 1.0.87 ] - 2024/08/20
- Added
SpotifyClient.DefaultDeviceIdproperty to get / set the default device id (or name) to use for player transport methods (e.g. play, pause, skip, etc) that do not specify a device id and there is no active Spotify player detected (e.g. "Office", "5d4931f9d0684b625d702eaa24137b2c1d99539c", etc). This should avoid theNo Active Deviceexceptions returned from the Spotify Web API when playback transport methods are called after long pauses of inactivity.
[ 1.0.86 ] - 2024/08/19
- Updated
SpotifyClient,ZeroconfConnect, andAuthClientclass constructors to include thetokenStorageFileargument that specifies the filename and extension of the authorization Token Cache file. This is used for Spotify Connect devices that utilize theauthorization_codetoken type.
[ 1.0.85 ] - 2024/08/19
- Updated
SpotifyClient.RemoveAudiobookFavoritesmethod to make theidsargument optional; if not supplied, the currently playing audiobook id value is used instead. - Updated
SpotifyClient.RemoveEpisodeFavoritesmethod to make theidsargument optional; if not supplied, the currently playing episode id value is used instead. - Updated
SpotifyClient.RemoveShowFavoritesmethod to make theidsargument optional; if not supplied, the currently playing show id value is used instead. - Updated
SpotifyClient.SaveAudiobookFavoritesmethod to make theidsargument optional; if not supplied, the currently playing audiobook id value is used instead. - Updated
SpotifyClient.SaveEpisodeFavoritesmethod to make theidsargument optional; if not supplied, the currently playing episode id value is used instead. - Updated
SpotifyClient.SaveShowFavoritesmethod to make theidsargument optional; if not supplied, the currently playing show id value is used instead.
[ 1.0.84 ] - 2024/08/18
- Updated
SpotifyClient.PlayerTransferPlaybackmethod to default therefreshDeviceListargument to True so that the Spotify Connect device list is refreshed by default before transferring playback. - Updated
ZeroconfConnectmethods to useconnection:closeheaders for requests to the Spotify Connect Zeroconf API endpoints.
[ 1.0.83 ] - 2024/08/15
- Updated
SpotifyClient.GetSpotifyConnectDevicemethod to check if a Spotify Desktop Client Application OAuth2 token exists when a PlayerTransfer targets a Sonos device. If not found, then control will be transferred to the Sonos device using it's local queue; if found, then Spotify Connect will reconnect to the device and control will be transferred to the Sonos device using Spotify Connect.
[ 1.0.82 ] - 2024/08/15
- Updated
SpotifyClient.GetSpotifyConnectDevicemethod to get real-time information for some portions of the device info for devices detected by zeroconf discovery (non-dynamic), even when using the cache. Prior to this fix, transfer of playback failed for dynamic devices (web player, mobile app player, etc).
[ 1.0.81 ] - 2024/08/15
- Updated
SpotifyClient.GetSpotifyConnectDevicemethod to get real-time information for some portions of the device info, even when using the cache. Prior to this, stale information was being used that had been updated since the last cache update.
[ 1.0.80 ] - 2024/08/15
- Added
SpotifyClient.GetSpotifyConnectDevicemethod that will get information about a specific Spotify Connect player device, and (optionally) activate the device if it requires it. - Marked the
SpotifyClient.PlayerResolveDeviceIdmethod as deprecated, and it will be removed in a future release; use theGetSpotifyConnectDeviceinstead. - Removed
SpotifyClient.PlayerTransferPlaybackmethod argumentresolveDeviceIdas it is no longer used. - Added
SpotifyClient.PlayerTransferPlaybackmethod argumentrefreshDeviceListto refresh the Spotify Connect device list (True) or use the Spotify Connect device list cache (False) when resolving a Spotify Connect device value.
[ 1.0.79 ] - 2024/08/13
- Updated
ZeroconfConnect._GetSpotifyConnectAuthorizationCodeTokenmethod to raise an exception if the Spotify Client Application authorization access token could not be found. Prior logic was causing the process to wait for a user response to a token authorization request, which would never happen since the process was running on a server.
[ 1.0.78 ] - 2024/08/12
- Updated
ZeroconfConnectclass constructor to include thetokenStorageDirargument that specified the directory path that will contain thetokens.jsoncache file. This is used for Spotify Connect devices that utilize theauthorization_codetoken type.
[ 1.0.77 ] - 2024/08/12
- Updated
AuthClient.AuthorizeWithServermethod to specify a redirect uri with host, port, and path values. Prior code was only allowing a redirect uri with host and port values. - Added
SpotifyClient.SetAuthTokenAuthorizationCodemethod argumentredirectUriPathto allow a redirect_uri path value to be specified for OAuth authorization requests. - Added
SpotifyClient.SetAuthTokenAuthorizationCodePKCEmethod argumentredirectUriPathto allow a redirect_uri path value to be specified for OAuth authorization requests. - Updated
ZeronconfConnectclass to correctly process Spotify Connect requests for token typeauthorization_codedevices. - Updated
SpotifyClient.PlayerMediaPlayTrackFavoritesmethod to add thelimitTotalargument that limits the number of tracks retrieved from favorites. - Added
sortResultargument to the followingSpotifyClientmethods:GetAlbumFavorites,GetAlbumNewReleases,GetArtistAlbums,GetArtistsFollowed,GetAudiobookFavorites,GetBrowseCategorys,GetCategoryPlaylists,GetEpisodeFavorites,GetFeaturedPlaylists,GetPlayerDevices,GetPlaylistFavorites,GetPlaylistsForUser,GetShowFavorites,GetSpotifyConnectDevices,GetTrackFavorites,GetUsersTopArtists,GetUsersTopTracks. If True (default), result items are sorted by name prior to returning to the caller; otherwise, results are left in the order that the Spotify Web API returned them.
[ 1.0.76 ] - 2024/07/18
- Updated
ZeroconfConnectclass to remove some test code that was accidentally left in place for tokentypeauthorization_coderesearch.
[ 1.0.75 ] - 2024/07/17
- Updated
PlayerPlayState.ShuffleStatemethod to return a boolean True or False value to account for changes to underlying Spotify Web API. - Updated
PlayerPlayState.SmartShufflemethod to return a boolean True or False value to account for changes to underlying Spotify Web API.
[ 1.0.74 ] - 2024/07/15
- Added
SpotifyConnectDevices.GetDeviceByIdmethod to return aSpotifyConnectDeviceinstance if the collection contains the specified device id value; otherwise, None. - Added
SpotifyConnectDevices.GetDeviceByNamemethod to return aSpotifyConnectDeviceinstance if the collection contains the specified device name value; otherwise, None. - Updated
ZeroconfConnectclass to use a '2.7.1' version indicator if no version argument was specified on the class contructor. - Updated
ZeroconfConnect.Disconnectto check for an invalid JSON response. It has been found that some devices (Sonos, etc) do not return a proper JSON response for theresetUsersaction. If a JSON response was not returned, then it will treat the http status code as the response code; if it's not a 200, then it will raise an exception. - Updated
SpotifyClient.PlayerResolveDeviceIdmethod to not switch the active user context for Sonos devices. Sonos devices are restricted, and (currently) cannot be controlled by the Spotify Web-Services API player methods.
[ 1.0.73 ] - 2024/07/02
- Updated
SpotifyClient.GetSpotifyConnectDevicesto gracefully handle device unavailable scenarios. It will try to reach the device by its direct HostIpAddress first; if that fails, then it will try to reach the device by its Server alias; if that fails, then it will log a warning that the device could not be reached and press on. - Updated
ZeroconfConnect.Disconnectto check for an invalid JSON response. It has been found that some devices (Sonos, etc) do not return a proper JSON response for theresetUsersaction. If a JSON response was not returned, then it will treat the http status code as the response code; if it's not a 200, then it will raise an exception. - Updated
BlobBuildermethods to add tracing of blob data contents.
[ 1.0.72 ] - 2024/06/28
- Updated
ZeroconfConnect.Connectmethod to handle theauthorization_codetoken type for Zeroconf APIaddUserrequests.
[ 1.0.71 ] - 2024/06/27
- Updated
ZeroconfConnect.Connectmethod to properly return the response data from theaddUserrequest and process the results.
[ 1.0.70 ] - 2024/06/27
- Updated
ZeroconfConnect.Connectmethod to properly wait for device to become fully availabile if need be.
[ 1.0.69 ] - 2024/06/26
- Added properties and arguments to support the Zeroconf API
loginIdargument for theaddUserrequest. - Updated
ZeroconfConnect.Connectmethod to include thedeviceNameanddeviceIdkeys for theaddUserrequest for certain device manufacturer conditions. - Updated
ZeroconfConnect.Connectmethod to not issue a Disconnect to reset the user context if the public key value is "INVALID", as the logic did not work as expected.
[ 1.0.68 ] - 2024/06/26
- Updated
ZeroconfConnect._CheckResponseForErrorsmethod to not process the Spotify Zeroconf API response, as each method calling the check response method will process the returned status.
[ 1.0.67 ] - 2024/06/25
- Updated
SpotifyClient.IsDeviceIdclass to recognize UUID-formatted device id's (e.g. "48b677ca-ef9b-516f-b702-93bf2e8c67ba"). - Updated
ZeroconfConnectclass to not default theversionvalue to1.0, in the event that newer devices may not support that version identifier. - Updated
ZeroconfConnect.Connectmethod to not pass theloginIdparameter to the request. - Updated
ZeroconfConnect.Connectmethod to issue a Disconnect to reset the user context if the public key value is "INVALID".
[ 1.0.66 ] - 2024/06/25
- Updated
ZeroconfResponseclass to convert thestatusandspotifyErrorvalues to numeric from string. Some Spotify Connect devices return them as strings, while other return them as numerics.
[ 1.0.65 ] - 2024/06/25
- Updated
ZeroconfConnect.Connectmethod to account for "ERROR-INVALID-PUBLICKEY" statuses returned for some devices. This will retry the connection request with the PublicKey value returned from the initial request.
[ 1.0.64 ] - 2024/06/24
- Updated
SpotifyClient.GetSpotifyConnectDevicesmethod to correctly set the currently active device.
[ 1.0.63 ] - 2024/06/24
- Updated
ZeroconfConnectclass to process the Spotify Zeroconf API status code from the JSON response instead of processing the HTTP request status code. It has been found that some Spotify Connect manufacturers return different HTTP status codes than other manufacturers; but the Spotify Connectstatus,statusStringandspotifyErrorJSON properties seem to be consistent across the board. - Updated
SpotifyClient.GetSpotifyConnectDevicesmethod to filter out duplicate Spotify Connect Device entries for devices that have been grouped together. For example, the "Bose-ST10-1" and "Bose-ST10-2" are grouped as a stereo pair; there will be two Zeroconf discovery result entries with different instance names, but their Zeroconf getInfo endpoint url will be the same. When this happens, it causes the values to show up as duplicates if we process both of them.
[ 1.0.62 ] - 2024/06/21
- Updated
SpotifyDiscovery.DiscoverDevicesmethod to properly free Zeroconf resources after service discovery, and prevent possible memory leaks and crashes due to running out of resources.
[ 1.0.61 ] - 2024/06/21
- Added
ZeroconfGetInfo.IsInDeviceListproperty that returns the status of active device list verification process (Verification not Performed, Verified Active, Verified Inactive).
[ 1.0.60 ] - 2024/06/21
- Updated
ZeroconfConnectclass to process all responses as JSON responses. It was found that some Spotify Zeroconf API capable devices were not properly setting theContent-Typein the returned http response header. - Updated
SpotifyDiscoveryclass to process the individual Spotify Connect instance names that were discovered via Zeroconf. Prior logic was adding a device for every IPV4 address that was found for an instance, assuming that each instance only contained one IP address; some services contain multiple IP addressess for the same instance name (specifically, theSpotifyConnectadd-on, which runs in a docker container). - Updated
SpotifyDiscoveryclass to rename theHostIpv4Addressproperty (and method arguments) toHostIpAddress. The address specified in this argument can be an IP address (e.g. "192.168.1.81") or an alias (e.g. "bose.speaker.kitchen"). - Updated
ZeroconfConnectclass to rename theHostIpv4Addressproperty (and method arguments) toHostIpAddress. The address specified in this argument can be an IP address (e.g. "192.168.1.81") or an alias (e.g. "bose.speaker.kitchen"). - Updated various
SpotifyClientmethods to utilize the defaultHostIpAddress(orServervalue if defaultHostIpAddresswas not discovered) when connecting to a Spotify Connect capable device. Methods updated were:PlayerActivateDevices,GetSpotifyConnectDevices,PlayerResolveDeviceId.
[ 1.0.59 ] - 2024/06/19
- Updated
SpotifyClientmethods that callPlayerResolveDeviceIdwith a new parameter that indicates if the device should be resolved (true) or not (False). This allows multiple methods that callPlayerResolveDeviceIdto be called from the same method, and only resolve the device one time. This was sone to ensure that device resolution did not occur more than once, as it's such a time consuming operation. Methods updated were:PlayerMediaPlayContext,PlayerMediaPlayTrackFavorites,PlayerMediaPlayTracks,PlayerTransferPlayback.
[ 1.0.58 ] - 2024/06/19
- Updated
SpotifyClient.PlayerResolveDeviceIdmethod callers to log a warning message if the specified device value could not be resolved and just return a null value.
[ 1.0.57 ] - 2024/06/19
- Updated
SpotifyClient.PlayerResolveDeviceIdmethod callers to gracefully handle theSpotifyApiErrorerror if the specified device value could not be resolved.
[ 1.0.56 ] - 2024/06/19
- Updated
SpotifyClient.PlayerResolveDeviceIdmethod to raise aSpotifyApiErrorerror if the specified device value could not be resolved.
[ 1.0.55 ] - 2024/06/19
- Updated
SpotifyConnectDevicesmodel to include aDateLastRefreshedproperty that indicates when the device list was last refreshed.
[ 1.0.54 ] - 2024/06/19
- Updated
SpotifyClient.GetSpotifyConnectDevicesmethod to store results to the configuration cache.
[ 1.0.53 ] - 2024/06/18
- Updated
ZeroconfConnect.Connectmethod to provide a small delay after processing the Spotify Zeroconf API command, which will give the device some time to process the change. - Updated
ZeroconfConnect.Disconnectmethod to provide a small delay after processing the Spotify Zeroconf API command, which will give the device some time to process the change.
[ 1.0.52 ] - 2024/06/18
- Updated
SpotifyClient.GetSpotifyConnectDevicesmethod to retrieve dynamic Spotify Connect devices as well as static devices. Dynamic devices are Spotify Connect devices that are not found in Zeroconf discovery process, but still exist in the player device list. These are usually Spotify Connect web or mobile players with temporary device id's.
[ 1.0.51 ] - 2024/06/18
- Added
SpotifyClient.GetSpotifyConnectDevicesmethod that gets information about all available Spotify Connect player devices (not just ones controlled by a user).
[ 1.0.50 ] - 2024/06/18
- Added
SpotifyClient.ZeroconfClientproperty that contains a reference to the Zeroconf client instance used to discover Spotify Connect devices. - Added
SpotifyDiscovery.ZeroconfClientproperty that contains a reference to the Zeroconf client instance used to discover Spotify Connect devices.
[ 1.0.49 ] - 2024/06/18
- Added
SpotifyClient.PlayerActivateDevicesmethod that activates all Spotify Connect player devices, and (optionally) switches the active user context to the current user context. Note that you can still activate individual devices using theZeroconfConnect.Connectmethod if you wish. - Added
SpotifyClient.PlayerResolveDeviceIdmethod that resolves a Spotify Connect device identifier from a specified device id, name, alias id, or alias name. This will ensure that the device id can be found on the network, as well as connect to the device (if necessary) with the current user context. - Updated various
SpotifyClientmethods to utilize the newSpotifyClient.PlayerResolveDeviceIdmethod so that device id's are automatically activated if they are currently deactivated but available on the local network. Methods updated were:PlayerMediaPlayContext,PlayerMediaPlayTrackFavorites,PlayerMediaPlayTracks,PlayerTransferPlayback. - Updated
SpotifyClientclass constructor so that Spotify Connect user context credentials (e.g. username and password) may be supplied for the resolution of device id / name. Note these credentials are only used for Spotify Connect device resolution, and are not used by method calls that are made to the underlying Spotify Web API. - Updated
SpotifyDiscoveryclass constructor so that aZeroconfinstance can be provided. This allows Home Assistant integrations to use the HA Zeroconf instance and avoid the log warnings of multiple Zeroconf instances in use. - Removed
SpotifyClientprocessing from theSpotifyDiscoveryclass, as the processing was moved into theSpotifyClientclass itself.
[ 1.0.48 ] - 2024/06/10
- Forgot to re-build prior to deploying!
[ 1.0.47 ] - 2024/06/10
- Moved all Spotify Zeroconf API related classes to a new namespace called
zeroconfapi. Classes moved were:ZeroconfResponse,ZeroconfGetInfo,ZeroconfGetInfoAlias,ZeroconfGetInfoDrmMediaFormat. - Added
ZeroconfConnectclass that contains various methods that support interfacing with the Spotify Zeroconf API. - Added
ZeroconfConnect.Connectmethod that calls theaddUserSpotify Zeroconf API endpoint to issue a call to SpConnectionLoginBlob. If successful, the associated device id is added to the Spotify Connect active device list for the specified user account. - Added
ZeroconfConnect.Disconnectmethod that calls theresetUsersSpotify Zeroconf API endpoint to issue a call to SpConnectionLogout; the currently logged in user (if any) will be logged out of Spotify Connect, and the device id removed from the active Spotify Connect device list. - Added
ZeroconfConnect.GetInformationmethod that calls thegetInfoSpotify Zeroconf API endpoint to return information about the device. - Removed
SpotifyClient.ZeroconfAddUsermethod, and replaced it with methodZeroconfConnect.Connect. - Removed
SpotifyClient.ZeroconfResetUsersmethod, and replaced it with methodZeroconfConnect.Disconnect. - Removed
SpotifyClient.ZeroconfGetInformationmethod, and replaced it with methodZeroconfConnect.GetInformation.
[ 1.0.46 ] - 2024/06/07
- Updated the following requirements due to Home Assistant dependency issues: 'oauthlib>=3.2.2', 'platformdirs>=4.1.0', 'requests>=2.31.0', 'requests_oauthlib>=1.3.1', 'zeroconf>=0.132.2'.
[ 1.0.45 ] - 2024/06/07
- Updated
zeroconfrequirements to "zeroconf>=0.132.2". This was causing installation issues with other components that utilize zeroconf.
[ 1.0.44 ] - 2024/06/07
- Added
SpotifyDiscovery.DiscoveredResultsclass property that will contain an array ofZeroconfDiscoveryResultitems that contain discovery details for each service that was discovered. - Added model
ZeroconfDiscoveryResultclass that contains detailed Zeroconf ServiceInfo details that were discovered via Zeroconf. - Added model
ZeroconfPropertyclass that contains Zeroconf ServiceInfo property details that were discovered via Zeroconf. - Added model
ZeroconfResponseclass that contains Zeroconf basic response variables. - Added model
ZeroconfGetInfoclass that contains Zeroconf action=getInfo response variables. - Added model
ZeroconfGetInfoAliasclass that contains Zeroconf action=getInfo Alias response variables. - Added model
ZeroconfGetInfoDrmMediaFormatclass that contains Zeroconf action=getInfo DRM Media format response variables. - Added logic to handle
503 Server Errorresponses from the Spotify Web API. - Added support for Spotify DJ playlist retrieval. As the Spotify Web API does not support retrieving the DJ playlist (
spotify:playlist:37i9dQZF1EYkqdzj48dyYq), it simply returns a manually built representation of the playlist. Note that playlist tracks cannot be retrieved either for the DJ playlist, as the Spotify Web API does not support it.
[ 1.0.43 ] - 2024/04/21
- Added device name support to the following player methods that take a
deviceIdargument for player functions. You can now specify either a device id or device name in thedeviceIdargument to target a specific Spotify Connect Player device.SpotifyClientmethods updated were:AddPlayerQueueItem,PlayerMediaPause,PlayerMediaPlayContext,PlayerMediaPlayTrackFavorites,PlayerMediaPlayTracks,PlayerMediaResume,PlayerMediaSeek,PlayerMediaSkipNext,PlayerMediaSkipPrevious,PlayerSetRepeatMode,PlayerSetShuffleMode,PlayerSetVolume,PlayerTransferPlayback. - Added
SpotifyClient.PlayerConvertDeviceNameToIdmethod that converts a Spotify Connect player device name to it's equivalent id value if the value is a device name. If the value is a device id, then the value is returned as-is.
[ 1.0.42 ] - 2024/04/05
- Added
Device.IsMutedproperty to indicate if volume is zero (muted) or not (unmuted). - Added
PlayerPlayState.IsMutedproperty to indicate if player device volume is zero (muted) or not (unmuted). - Updated
SpotifyClient.PlayerMediaPlayTrackFavoritesmethod to set the shuffle mode prior to starting play of the track list. Prior to this change, the first track would always play first regardless of the shuffle setting; now it is part of the shuffle.
[ 1.0.41 ] - 2024/04/02
- Added
ArtistInfomodel that contains artist bio information. - Added
ArtistInfoTourEventmodel that contains artist on tour event information. - Added
SpotifyClient.GetArtistInfomethod to retrieve artist bio information for a specified Artist id. - Added
SpotifyClient.PlayerMediaPlayTrackFavoritesmethod to play all tracks contained in the current users track favorites. - Added
SpotifyClient.RemovePlaylistmethod to remove a playlist by calling theUnfollowPlaylistmethod.
[ 1.0.40 ] - 2024/03/26
- Updated
SpotifyClient.PlayerVerifyDeviceDefaultmethod to check for a nullDevice.Idvalue when determining if an active device was set. - Added
delayargument to variousSpotifyClientplayer command-related methods, which allows the Spotify Web API a little bit of time to process the change before returning from the method. Methods updated:PlayerMediaPause,PlayerMediaPlayContext,PlayerMediaPlayTracks,PlayerMediaResume,PlayerMediaSeek,PlayerMediaSkipNext,PlayerMediaSkipPrevious,PlayerSetRepeatMode,PlayerSetShuffleMode,PlayerSetVolume,PlayerTransferPlayback,PlayerVerifyDeviceDefault. Default delay is 250 milliseconds, but you can adjust accordingly (including removing the delay if you wish).
[ 1.0.39 ] - 2024/03/26
- Updated
PlayerPlayState.__init__model to properly parse the Actions property.
[ 1.0.38 ] - 2024/03/26
- Updated
Device.__init__model to validate the following properties were initialized from Spotify Web API results, and to set defaults if not: IsActive = False, IsPrivateSession = False, IsRestricted = False, SupportsVolume = False, VolumePercent = 0. - Updated
PlayerPlayState.__init__model to validate the following properties were initialized from Spotify Web API results, and to set defaults if not: Actions = PlayerActions(), Device = Device(), CurrentlyPlayingType = 'unknown', IsPlaying = False, ProgressMS = 0, RepeatState = 'off', ShuffleState = 'off', SmartShuffle = 'off', Timestamp = 0. - Updated
PlayerActions.__init__model to validate the following properties were initialized from Spotify Web API results, and to set defaults if not: InterruptingPlayback = False, Pausing = False, Resuming = False, Seeking = False, SkippingNext = False, SkippingPrev = False, TogglingRepeatContext = False, TogglingRepeatTrack = False, TogglingShuffle = False, TransferringPlayback = False.
[ 1.0.37 ] - 2024/03/19
- Updated
SpotifyClient.FollowArtistsmethod to make theidsargument optional; if not supplied, the currently playing track artist id value is used instead. - Updated
SpotifyClient.UnfollowArtistsmethod to make theidsargument optional; if not supplied, the currently playing track artist id value is used instead. - Updated
SpotifyClient.SaveAlbumFavoritesmethod to make theidsargument optional; if not supplied, the currently playing track album id value is used instead. - Updated
SpotifyClient.RemoveAlbumFavoritesmethod to make theidsargument optional; if not supplied, the currently playing track album id value is used instead. - Updated
SpotifyClient.CreatePlaylistmethod to add theimagePathargument, which assigns an image to the created playlist. - Updated
SpotifyClient.ChangePlaylistDetailsmethod to add theimagePathargument, which assigns an image to the updated playlist details.
[ 1.0.36 ] - 2024/03/19
- Fixed
SpotifyClient.SaveTrackFavoritesmethod for a bug introduced with v1.0.35 update causeing 'object of type 'bool' has no len()' exceptions. - Fixed
SpotifyClient.RemoveTrackFavoritesmethod for a bug introduced with v1.0.35 update causeing 'object of type 'bool' has no len()' exceptions. - Fixed
SpotifyClient.AddPlaylistItemsmethod for a bug introduced with v1.0.35 update causeing 'object of type 'bool' has no len()' exceptions. - Fixed
SpotifyClient.RemovePlaylistItemsmethod for a bug introduced with v1.0.35 update causeing 'object of type 'bool' has no len()' exceptions.
[ 1.0.35 ] - 2024/03/18
- Updated
SpotifyClient.SaveTrackFavoritesmethod to make theidsargument optional; if not supplied, the currently playing id value is used instead. - Updated
SpotifyClient.RemoveTrackFavoritesmethod to make theidsargument optional; if not supplied, the currently playing id value is used instead. - Updated
SpotifyClient.AddPlaylistItemsmethod to make theurisargument optional; if not supplied, the currently playing uri value is used instead. - Updated
SpotifyClient.RemovePlaylistItemsmethod to make theurisargument optional; if not supplied, the currently playing uri value is used instead.
[ 1.0.34 ] - 2024/03/18
- Fixed
SpotifyClient.CreatePlaylistmethod to properly pass the Public and Collaborative parameters to the Spotify Web API. Prior to this, any created playlists were being marked with Public=True.
[ 1.0.33 ] - 2024/03/02
- Added
Device.SelectItemNameAndIdproperty to return a string that can be used in a selection list in the form of "Name (Id)". - Added
Device.GetIdFromSelectItemmethod to return the Id portion of aSelectItemNameAndIdproperty value. - Added
Device.GetNameFromSelectItemmethod to return the Name portion of aSelectItemNameAndIdproperty value.
[ 1.0.32 ] - 2024/02/28
- Updated
PlayerQueueInfoto correctly return theSummaryproperty value when the queue is empty. - Removed
SpotifyClient.SearchPlaylistsmethod argumentspotifyOwnedOnly, as it can be replaced by other functionality (e.g.GetCategoryPlaylists).
[ 1.0.31 ] - 2024/02/27
- Updated all models that used a
root.get('...',[])syntax to useroot.get('...',None)instead, as Spotify Web API will sometimes return anullinstead of an[](empty array) for a key item value. This was causing methods to fail with'NoneType' object is not iterableerrors.
[ 1.0.30 ] - 2024/02/23
- Updated
SpotifyClient.SearchPlaylistsmethod with argumentspotifyOwnedOnlyto filter found items by owner. This simulates the spotify "content generated for you" functionality provided by the Spotify AI engine.
[ 1.0.29 ] - 2024/02/23
- Added
ContainsIdmethod to the following classes:AlbumPageSimplified,AudiobookPageSimplified,ChapterPageSimplified,EpisodePageSimplified,PlaylistPageSimplified,ShowPageSimplified, andTrackPageSimplified. - Updated
SpotifyClient.GetPlayerRecentTracksmethod with auto-pagination support to retrieve ALL available items (or up to a limit total).
[ 1.0.28 ] - 2024/02/21
- Added
SpotifyClient.SearchAlbumsmethod to search Spotify for matching Album criteria. - Added
SpotifyClient.SearchArtistsmethod to search Spotify for matching Artist criteria. - Added
SpotifyClient.SearchAudiobooksmethod to search Spotify for matching Audiobook criteria. - Added
SpotifyClient.SearchEpisodesmethod to search Spotify for matching Episode criteria. - Added
SpotifyClient.SearchPlaylistsmethod to search Spotify for matching Playlist criteria. - Added
SpotifyClient.SearchShowsmethod to search Spotify for matching Show criteria. - Added
SpotifyClient.SearchTracksmethod to search Spotify for matching Track criteria. - Updated
SpotifyClientmethods to add auto-pagination to retrieve ALL available items (or up to a limit total). Methods modified were:GetAlbumFavorites,GetAlbumNewReleases,GetArtistAlbums,GetArtistsFollowed,GetCategoryPlaylists,GetFeaturedPlaylists,GetPlaylistFavorites,GetPlaylistsForUser,GetPlaylistItems,GetAlbumTracks,GetAudiobookChapters,GetAudiobookFavorites,GetBrowseCategorys,GetEpisodeFavorites,GetShowEpisodes,GetShowFavorites,GetTrackFavorites,GetUsersTopArtists,GetUsersTopTracks. - Renamed
SpotifyClient.GetBrowseCategorysmethod toGetBrowseCategorysList. - Renamed
SpotifyClient.GetBrowseCategorysByPagemethod toGetBrowseCategorys. - Added
Category.Uriproperty to simulate a Spotify-like Uri value for a category. This is a helper property - no value with this name is returned from the Spotify Web API. - Updated
PageObjectmodel with property setters for theCursorBefore,CursorAfter,Limit,OffsetandTotalproperties. This allows a user to modify the values when performing custom paging operations. - Updated all
SpotifyClientmethods that utilize amarketargument to ensure that a market value was either supplied or implied (using an authorization access token with a user profile). The Spotify Web API was returning null results for some methods that did not supply a market value while using a public access token (e.g. no country code default).
[ 1.0.27 ] - 2024/02/20
- Updated
SpotifyClient.GetPlayerRecentTracksmethod to retrieve the last 24 hours of play history if neitherafterorbeforearguments were specified.
[ 1.0.26 ] - 2024/02/15
- Added
SpotifyClient.ToStringmethod to display a string representation of the class. - Added
SpotifyClient.ConfigurationCacheproperty to store static configuration objects. - Added
SpotifyClient.ClearConfigurationCachemethod to clear the configuration cache. - Updated
SpotifyClientmethods to add returned results to theConfigurationCachefor faster access:GetBrowseCategory,GetBrowseCategorys,GetGenres,GetMarkets,GetPlayerDevice,GetPlayerDevices,GetUsersCurrentProfile. This increases performance when accessing Spotify information that rarely changes.
[ 1.0.25 ] - 2024/02/10
- Updated urllib3 requirements to "urllib3>=1.21.1,<1.27", to ensure urllib3 version 2.0 is not used. Home Assistant requires urllib3 version less than 2. This was causing intermittent issues with calling requests resulting in **kwargs errors when used in Home Assistant!
[ 1.0.24 ] - 2024/02/10
- Updated
SpotifyClient.MakeRequestmethod to pass ALL parameters in the various request methods. Prior to this fix, there were urllib3 request issues with **KWARGS while using the api in a Home Assistant integration.
[ 1.0.23 ] - 2024/02/09
- Updated
SpotifyClient.MakeRequestmethod to use json library to create JSON request body, instead of the urllib3request(...,json=...)method. The urllib3requestclass seems to have issues processing json data.
[ 1.0.22 ] - 2024/02/09
- Added
SpotifyClient.GetIdFromUrimethod to return the Id portion of a Uri value. - Added
SpotifyClient.GetTypeFromUrimethod to return the Type portion of a Uri value. - Updated
SpotifyClient.GetPlayerDevicemethod to return a selected device by id or name. - Added
SpotifyDiscoveryclass that discovers Spotify Connect devices via Zeroconf. - Updated
UserProfileSimplifiedmethod to default theDisplayNameproperty to theIdproperty value if a display name was not set.
[ 1.0.21 ] - 2024/02/08
- Added
SearchResponse.GetSpotifyOwnedPlaylistsmethod that gets a list of all playlist items in the underlying search response that have an owner ofspotify:user:spotify. These are playlists that are generated for you by the spotify ai engine. - Added
additionalTypesargument toSpotifyClient.GetPlayerPlaybackStatemethod. - Added
additionalTypesargument toSpotifyClient.GetPlayerNowPlayingmethod. - Updated
SpotifyClient.GetPlayerDevicesmethod to return the list of devices in sorted order by Name.
[ 1.0.20 ] - 2024/02/07
- Added
PlayHistoryPage.GetTracksmethod that gets a list of all tracks contained in the underlyingPlayHistorylist. This is a convenience method so one does not have to loop through thePlayHistoryarray ofTrackobjects to get the list of tracks.
[ 1.0.19 ] - 2024/02/07
- Updated
TrackPageSavedmodel to parse aTrackobject instead of aTrackSimplifiedobject. TheTrackobject contains the extraAlbum,ExternalIdsandPopularityproperties. - Updated
TrackRecommendationsmodel to parse aTrackobject instead of aTrackSimplifiedobject. TheTrackobject contains the extraAlbum,ExternalIdsandPopularityproperties. - Added
AlbumPageSaved.GetAlbumsmethod that gets a list of all albums contained in the underlyingItemslist. This is a convenience method so one does not have to loop through theItemsarray ofAlbumSavedobjects to get the list of albums. - Added
TrackPageSaved.GetTracksmethod that gets a list of all tracks contained in the underlyingItemslist. This is a convenience method so one does not have to loop through theItemsarray ofTrackSavedobjects to get the list of tracks. - Added
EpisodePageSaved.GetEpisodesmethod that gets a list of all episodes contained in the underlyingItemslist. This is a convenience method so one does not have to loop through theItemsarray ofEpisodeSavedobjects to get the list of episodes. - Added
ShowPageSaved.GetShowsmethod that gets a list of all shows contained in the underlyingItemslist. This is a convenience method so one does not have to loop through theItemsarray ofShowSavedobjects to get the list of shows. - Added an
ImageUrlproperty to all models that have anImagescollection. The new property returns the first image url in theImageslist, if images are defined; otherwise, null. This is a convenience method so one does not have to loop through theImagesarray ofImageObjectobjects to get an image url.
[ 1.0.18 ] - 2024/02/05
- Updated
SpotifyClientmethods to set the request header authorization key directly, rather than assigning a new dictionary to the value. - Updated
SpotifyClient.MakeRequestmethod to apply token refresh changes to the request authorization header if present. Prior to this fix, the request was still referencing the expired token value. - Added
SpotifyAuthToken.HeaderKeyproperty for request header access. - Added
SpotifyAuthToken.HeaderValueproperty for request header access. - Removed
SpotifyAuthToken.GetHeadersmethod, as it was no longer required.
[ 1.0.17 ] - 2024/02/04
- Updated
SpotifyClientto correctly support thetokenUpdatercallable to update a token for an external provider. - Updated
AuthClientto correctly support thetokenUpdatercallable to update a token for an external provider.
[ 1.0.16 ] - 2024/02/02
- Updated numerous classes with a
ToDictionarymethod to allow dictionary representation of data.
[ 1.0.15 ] - 2024/02/02
- Updated
SpotifyClientmethods with better logging information. - Updated
AuthClientmethods with better logging information.
[ 1.0.14 ] - 2024/02/01
- Updated
SpotifyClientmethods to add basic validation for required parameter values.
[ 1.0.13 ] - 2024/02/01
- Updated
SpotifyClient._CheckResponseForErrorsmethod to use json library to parse JSON response, instead of the urllib3HTTPResponse.json()method. The urllib3HTTPResponseclass can return missing attributes and methods when processing redirects.
[ 1.0.12 ] - 2024/02/01
- Updated
SpotifyClient._CheckResponseForErrorsmethod with better logging information.
[ 1.0.11 ] - 2024/02/01
- Updated
SpotifyClient._CheckResponseForErrorsmethod with better logging information.
[ 1.0.10 ] - 2024/02/01
- Added
SpotifyClient.SetAuthTokenFromTokenmethod to allow the authorization token to be used from an existing OAuth2 token. - Removed
SpotifyClient.SetAuthTokenFromSessionmethod in favor of theSetAuthTokenFromTokenmethod. - Updated scope processing to pass a space-delimited string of scopes instead of an array of strings. It appears that the Spotify Web API will accept both, but API documentation states that a space-delimited string is preferred.
[ 1.0.9 ] - 2024/01/31
- Updated
SpotifyClient.SetAuthTokenFromSessionmethod to correct a bug related to Home Assistant OAuth2Session object.
[ 1.0.8 ] - 2024/01/31
- Added
SpotifyClient.SetAuthTokenFromSessionmethod to allow the authorization token to be used from an existing OAuth2Session.
[ 1.0.7 ] - 2024/01/29
- Allow customization of the redirect uri host and port values in the token authorization process.
[ 1.0.6 ] - 2024/01/29
- Changed urllib3 requirements to a non-specific version so it could run with Home Assistant addons.
[ 1.0.5 ] - 2024/01/29
- Changed Development Status to 5 - Production / Stable.
[ 1.0.4 ] - 2024/01/29
- Removed invalid requirement from setup.py.
[ 1.0.3 ] - 2024/01/29
- Added
SpotifyAuthToken.ProfileIdproperty that indicates the token profile that was loaded.
[ 1.0.2 ] - 2024/01/29
- Corrected the
SpotifyClient.GetTrackRecommendationsmethod to process themarket,maxSpeechiness, andtargetSpeechinessarguments correctly. - Updated
SpotifyClient.SetAuthTokenAuthorizationCodemethod to use a 120 second timeout value while waiting for an authorize response from the user. - Updated
SpotifyClient.SetAuthTokenAuthorizationCodePkcemethod to use a 120 second timeout value while waiting for an authorize response from the user.
[ 1.0.1 ] - 2024/01/17
- Version 1 initial release.