Client for Spotify. Inherit from this class to have your callbacks called on the appropriate events.
Exceptions raised in your callback handlers will be displayed on the standard error output (stderr).
Connect to the Spotify API using the given username and password.
This method calls the spotify.connect() function.
This method does not return before we disconnect from the Spotify service.
Terminate the current Spotify session.
Callback.
Called when the login completes. You almost certainly want to do something with session.playlist_container() if the login succeded.
| Parameters: |
|
|---|
Callback.
The user has or has been logged out from Spotify.
| Parameters: | session (spotify.Session) – the current session. |
|---|
Callback.
The current user’s metadata has been updated.
| Parameters: | session (spotify.Session) – the current session. |
|---|
Callback.
A connection error occured in libspotify.
| Parameters: |
|
|---|
Callback.
An informative message from libspotify, destinated to the user.
| Parameters: |
|
|---|
Callback.
When this method is called by libspotify, one should call session.process_events().
If you use the SessionManager‘s default loop, the default implementation of this method does the job. Though, if you implement your own loop for handling Spotify events, you’ll need to override this method.
Warning
This method is called from an internal thread in libspotify. You should make sure not to use the Spotify API from within it, as libspotify isn’t thread safe.
| Parameters: | session (spotify.Session) – the current session. |
|---|
Callback.
Called whenever new music data arrives from Spotify.
You should override this method or music_delivery_safe(), not both.
Warning
This method is called from an internal thread in libspotify. You should make sure not to use the Spotify API from within it, as libspotify isn’t thread safe.
| Parameters: |
|
|---|---|
| Returns: | number of frames consumed |
| Return type: | int |
This method does the same as music_delivery(), except that it’s called from the SpotifySessionManager loop. You can safely use Spotify APIs from within this method.
You should override this method or music_delivery(), not both.
Callback.
The playback stopped because a track was played from another application, with the same account.
| Parameters: | session (spotify.Session) – the current session. |
|---|
Callback.
A log message from libspotify.
| Parameters: |
|
|---|
Callback.
Playback has reached the end of the current track.
| Parameters: | session (spotify.Session) – the current session. |
|---|
Callback.
Called when storable credentials have been updated, usually called when we have connected to the AP.
Warning
This method is called from an internal thread in libspotify. You should make sure not to use the Spotify API from within it, as libspotify isn’t thread safe.
| Parameters: |
|
|---|