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
Artist
yourself 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
None
if 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
timeout
seconds with no resultsTimeout
is raised. Iftimeout
isNone
the default timeout is used.The method returns
self
to allow for chaining of calls.
-
portrait
(image_size=None, callback=None)[source]¶ The artist’s portrait
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 artist isn’t loaded or the artist has no portrait.
-
portrait_link
(image_size=None)[source]¶ A
Link
to the artist’s portrait.image_size
is anImageSize
value, 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
ArtistBrowser
for the artist.If
type
isNone
, it defaults toArtistBrowserType.FULL
.If
callback
isn’tNone
, it is expected to be a callable that accepts a single argument, anArtistBrowser
instance, 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
Artist
instance 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.Event
that 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
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 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
-1
if the request was served from local cache. ReturnsNone
if the artist browser isn’t loaded yet.
-
property
artist
¶ Get the
Artist
the browser is for.Will always return
None
if 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
ImageSize
of these images.If
callback
isn’tNone
, it is expected to be a callable that accepts a single argument, anImage
instance, 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
type
ofArtistBrowserType.NO_TRACKS
orArtistBrowserType.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
type
ofArtistBrowserType.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.
-