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'
-
property
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 resultsTimeout
is raised. Iftimeout
isNone
the default timeout is used.The method returns
self
to allow for chaining of calls.
-
property
is_available
¶ Whether the album is available in the current region.
Will always return
None
if the album isn’t loaded.
-
property
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 anImageSize
value, by defaultImageSize.NORMAL
.If
callback
isn’tNone
, it is expected to be a callable that accepts a single argument, anImage
instance, when the image is done loading.Will always return
None
if the album isn’t loaded or the album has no cover.
-
cover_link
(image_size=None)[source]¶ A
Link
to the album’s cover.image_size
is anImageSize
value, by defaultImageSize.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.
-
property
name
¶ The album’s name.
Will always return
None
if the album isn’t loaded.
-
property
year
¶ The album’s release year.
Will always return
None
if the album isn’t loaded.
-
browse
(callback=None)[source]¶ Get an
AlbumBrowser
for the album.If
callback
isn’tNone
, it is expected to be a callable that accepts a single argument, anAlbumBrowser
instance, when the browser is done loading.Can be created without the album being loaded.
-
property
-
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 callingAlbum.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.
-
property
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 resultsTimeout
is raised. Iftimeout
isNone
the default timeout is used.The method returns
self
to allow for chaining of calls.
-
property
error
¶ An
ErrorType
associated with the album browser.Check to see if there was problems creating the album browser.
-
property
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. ReturnsNone
if the album browser isn’t loaded yet.
-
property
album
¶ Get the
Album
the browser is for.Will always return
None
if the album isn’t loaded.
-
property
copyrights
¶ The album’s copyright strings.
Will always return an empty list if the album browser isn’t loaded.
-
property
tracks
¶ The album’s tracks.
Will always return an empty list if the album browser isn’t loaded.
-
property
review
¶ A review of the album.
Will always return an empty string if the album browser isn’t loaded.
-