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 resultsTimeout
is raised. Iftimeout
isNone
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 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.
-
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.
-
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.
-
-
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.
-
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.
-
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. ReturnsNone
if the album browser isn’t loaded yet.
-
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.
-