Playlist manager

class spotify.manager.SpotifyPlaylistManager

Handles Spotify playlists callbacks. To implement you own callbacks, inherit from this class.

Exceptions raised in your callback handlers will be displayed on the standard error output (stderr).

watch(playlist, userdata=None)

Listen to modifications events on a playlist.

unwatch(playlist, userdata=None)

Stop listening to events on the playlist.

tracks_added(playlist, tracks, position, userdata)

Callback

Called when tracks are inserted in the playlist.

Parameters:
  • playlist (spotify.Playlist) – playlist on which the event occured
  • tracks (list of spotify.Track) – list of added tracks
  • position (int) – position in which the tracks where inserted
tracks_moved(playlist, tracks, new_position, userdata)

Callback

Called when tracks are moved in the playlist.

Parameters:
  • playlist (spotify.Playlist) – playlist on which the event occured
  • tracks (list of spotify.Track) – list of moved tracks
  • new_position (int) – new position of the tracks
tracks_removed(playlist, tracks, userdata)

Callback

Called when tracks are removed from the playlist.

Parameters:
playlist_renamed(playlist, userdata)

Callback

Called when a playlist has been renamed. spotify.Playlist.name() can be used to find out the new name.

Parameters:playlist (spotify.Playlist) – playlist on which the event occured
playlist_state_changed(playlist, userdata)

Callback

Called when state changed for a playlist.

There are three states that trigger this callback:

  • Collaboration for this playlist has been turned on or off.
  • The playlist started having pending changes, or all pending changes have now been committed.
  • The playlist started loading, or finished loading.
Parameters:playlist (spotify.Playlist) – playlist on which the event occured
playlist_update_in_progress(playlist, done, userdata)

Callback

Called when a playlist is updating or is done updating.

This is called before and after a series of changes are applied to the playlist. It allows e.g. the user interface to defer updating until the entire operation is complete.

Parameters:
  • playlist (spotify.Playlist) – playlist on which the event occured
  • done (bool) – whether the update is finished
playlist_metadata_updated(playlist, userdata)

Callback

Called when metadata for one or more tracks in a playlist has been updated.

Parameters:playlist (spotify.Playlist) – playlist on which the event occured
track_created_changed(playlist, position, user, when, userdata)

Callback

Called when create time and/or creator for a playlist entry changes.

Parameters:
  • playlist (spotify.Playlist) – playlist on which the event occured
  • position (int) – track’s position in the playlist
  • user (spotify.User) – creator of the playlist
  • when (int) – time in seconds since the UNIX Epoch
track_message_changed(playlist, position, message, userdata)

Callback

Called when message attribute for a playlist entry changes.

Parameters:
  • playlist (spotify.Playlist) – playlist on which the event occured
  • position (int) – track’s position in the playlist
  • message (unicode) – new message
track_seen_changed(playlist, position, seen, userdata)

Callback

Called when seen attribute for a playlist entry changes.

Parameters:
  • playlist (spotify.Playlist) – playlist on which the event occured
  • position (int) – track’s position in the playlist
  • seen (bool) – new seen attribute
description_changed(playlist, description, userdata)

Callback

Called when playlist description has changed.

Parameters:
  • playlist (spotify.Playlist) – playlist on which the event occured
  • description (unicode) – new description
subscribers_changed(playlist, userdata)

Callback

Called when playlist subscribers changes (count or list of names).

Parameters:playlist (spotify.Playlist) – playlist on which the event occured
image_changed(playlist, image, userdata)

Callback

Called when playlist image has changed.

Parameters:
  • playlist (spotify.Playlist) – playlist on which the event occured
  • image (str) – image id of the new image