Albums

class spotify.Album(session, uri=None, sp_album=None, add_ref=True)[source]

A Spotify album.

You can get an album from a track or an artist, or you can create an Album yourself from a Spotify URI:

>>> session = spotify.Session()
# ...
>>> album = session.get_album('spotify:album:6wXDbHLesy6zWqQawAa91d')
>>> album.load().name
u'Forward / Return'
is_loaded

Whether the album’s data is loaded.

load(timeout=None)[source]

Block until the album’s data is loaded.

After timeout seconds with no results Timeout is raised. If timeout is None the default timeout is used.

The method returns self to allow for chaining of calls.

is_available

Whether the album is available in the current region.

Will always return None if the album isn’t loaded.

artist

The artist of the album.

Will always return None if the album isn’t loaded.

cover(image_size=None, callback=None)[source]

The album’s cover Image.

image_size is an ImageSize value, by default ImageSize.NORMAL.

If callback isn’t None, it is expected to be a callable that accepts a single argument, an Image instance, when the image is done loading.

Will always return None if the album isn’t loaded or the album has no cover.

A Link to the album’s cover.

image_size is an ImageSize value, by default ImageSize.NORMAL.

This is equivalent with album.cover(image_size).link, except that this method does not need to create the album cover image object to create a link to it.

name

The album’s name.

Will always return None if the album isn’t loaded.

year

The album’s release year.

Will always return None if the album isn’t loaded.

type

The album’s AlbumType.

Will always return None if the album isn’t loaded.

A Link to the album.

browse(callback=None)[source]

Get an AlbumBrowser for the album.

If callback isn’t None, it is expected to be a callable that accepts a single argument, an AlbumBrowser instance, when the browser is done loading.

Can be created without the album being loaded.

class spotify.AlbumBrowser(session, album=None, callback=None, sp_albumbrowse=None, add_ref=True)[source]

An album browser for a Spotify album.

You can get an album browser from any Album instance by calling Album.browse():

>>> session = spotify.Session()
# ...
>>> album = session.get_album('spotify:album:6wXDbHLesy6zWqQawAa91d')
>>> browser = album.browse()
>>> browser.load()
>>> len(browser.tracks)
7
loaded_event = None

threading.Event that is set when the album browser is loaded.

is_loaded

Whether the album browser’s data is loaded.

load(timeout=None)[source]

Block until the album browser’s data is loaded.

After timeout seconds with no results Timeout is raised. If timeout is None the default timeout is used.

The method returns self to allow for chaining of calls.

error

An ErrorType associated with the album browser.

Check to see if there was problems creating the album browser.

backend_request_duration

The time in ms that was spent waiting for the Spotify backend to create the album browser.

Returns -1 if the request was served from local cache. Returns None if the album browser isn’t loaded yet.

album

Get the Album the browser is for.

Will always return None if the album isn’t loaded.

artist

The Artist of the album.

Will always return None if the album isn’t loaded.

copyrights

The album’s copyright strings.

Will always return an empty list if the album browser isn’t loaded.

tracks

The album’s tracks.

Will always return an empty list if the album browser isn’t loaded.

review

A review of the album.

Will always return an empty string if the album browser isn’t loaded.

class spotify.AlbumType[source]
ALBUM = <AlbumType.ALBUM: 0>
COMPILATION = <AlbumType.COMPILATION: 2>
SINGLE = <AlbumType.SINGLE: 1>
UNKNOWN = <AlbumType.UNKNOWN: 3>