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
Albumyourself 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
timeoutseconds with no resultsTimeoutis raised. IftimeoutisNonethe default timeout is used.The method returns
selfto allow for chaining of calls.
-
property
is_available¶ Whether the album is available in the current region.
Will always return
Noneif the album isn’t loaded.
-
property
artist¶ The artist of the album.
Will always return
Noneif the album isn’t loaded.
-
cover(image_size=None, callback=None)[source]¶ The album’s cover
Image.image_sizeis anImageSizevalue, by defaultImageSize.NORMAL.If
callbackisn’tNone, it is expected to be a callable that accepts a single argument, anImageinstance, when the image is done loading.Will always return
Noneif the album isn’t loaded or the album has no cover.
-
cover_link(image_size=None)[source]¶ A
Linkto the album’s cover.image_sizeis anImageSizevalue, 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
Noneif the album isn’t loaded.
-
property
year¶ The album’s release year.
Will always return
Noneif the album isn’t loaded.
-
browse(callback=None)[source]¶ Get an
AlbumBrowserfor the album.If
callbackisn’tNone, it is expected to be a callable that accepts a single argument, anAlbumBrowserinstance, 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
Albuminstance 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.Eventthat 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
timeoutseconds with no resultsTimeoutis raised. IftimeoutisNonethe default timeout is used.The method returns
selfto allow for chaining of calls.
-
property
error¶ An
ErrorTypeassociated 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
-1if the request was served from local cache. ReturnsNoneif the album browser isn’t loaded yet.
-
property
album¶ Get the
Albumthe browser is for.Will always return
Noneif 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.
-