Artists¶
-
class
spotify.Artist(session, uri=None, sp_artist=None, add_ref=True)[source]¶ A Spotify artist.
You can get artists from tracks and albums, or you can create an
Artistyourself from a Spotify URI:>>> session = spotify.Session() # ... >>> artist = session.get_artist( ... 'spotify:artist:22xRIphSN7IkPVbErICu7s') >>> artist.load().name u'Rob Dougan'
-
property
name¶ The artist’s name.
Will always return
Noneif the artist isn’t loaded.
-
property
is_loaded¶ Whether the artist’s data is loaded.
-
load(timeout=None)[source]¶ Block until the artist’s data is loaded.
After
timeoutseconds with no resultsTimeoutis raised. IftimeoutisNonethe default timeout is used.The method returns
selfto allow for chaining of calls.
-
portrait(image_size=None, callback=None)[source]¶ The artist’s portrait
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 artist isn’t loaded or the artist has no portrait.
-
portrait_link(image_size=None)[source]¶ A
Linkto the artist’s portrait.image_sizeis anImageSizevalue, by defaultImageSize.NORMAL.This is equivalent with
artist.portrait(image_size).link, except that this method does not need to create the artist portrait image object to create a link to it.
-
browse(type=None, callback=None)[source]¶ Get an
ArtistBrowserfor the artist.If
typeisNone, it defaults toArtistBrowserType.FULL.If
callbackisn’tNone, it is expected to be a callable that accepts a single argument, anArtistBrowserinstance, when the browser is done loading.Can be created without the artist being loaded.
-
property
-
class
spotify.ArtistBrowser(session, artist=None, type=None, callback=None, sp_artistbrowse=None, add_ref=True)[source]¶ An artist browser for a Spotify artist.
You can get an artist browser from any
Artistinstance by callingArtist.browse():>>> session = spotify.Session() # ... >>> artist = session.get_artist( ... 'spotify:artist:421vyBBkhgRAOz4cYPvrZJ') >>> browser = artist.browse() >>> browser.load() >>> len(browser.albums) 7
-
loaded_event= None¶ threading.Eventthat is set when the artist browser is loaded.
-
property
is_loaded¶ Whether the artist browser’s data is loaded.
-
load(timeout=None)[source]¶ Block until the artist 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 artist browser.Check to see if there was problems creating the artist browser.
-
property
backend_request_duration¶ The time in ms that was spent waiting for the Spotify backend to create the artist browser.
Returns
-1if the request was served from local cache. ReturnsNoneif the artist browser isn’t loaded yet.
-
property
artist¶ Get the
Artistthe browser is for.Will always return
Noneif the artist browser isn’t loaded.
-
portraits(callback=None)[source]¶ The artist’s portraits.
Due to limitations in libspotify’s API you can’t specify the
ImageSizeof these images.If
callbackisn’tNone, it is expected to be a callable that accepts a single argument, anImageinstance, when the image is done loading. The callable will be called once for each portrait.Will always return an empty list if the artist browser isn’t loaded.
-
property
tracks¶ The artist’s tracks.
Will be an empty list if the browser was created with a
typeofArtistBrowserType.NO_TRACKSorArtistBrowserType.NO_ALBUMS.Will always return an empty list if the artist browser isn’t loaded.
-
property
tophit_tracks¶ The artist’s top hit tracks.
Will always return an empty list if the artist browser isn’t loaded.
-
property
albums¶ The artist’s albums.
Will be an empty list if the browser was created with a
typeofArtistBrowserType.NO_ALBUMS.Will always return an empty list if the artist browser isn’t loaded.
-
property
similar_artists¶ The artist’s similar artists.
Will always return an empty list if the artist browser isn’t loaded.
-
property
biography¶ A biography of the artist.
Will always return an empty string if the artist browser isn’t loaded.
-