libspotify
Typedefs | Functions
Artist browsing

Typedefs

typedef void artistbrowse_complete_cb (sp_artistbrowse *result, void *userdata)
 

Functions

sp_artistbrowsesp_artistbrowse_create (sp_session *session, sp_artist *artist, sp_artistbrowse_type type, artistbrowse_complete_cb *callback, void *userdata)
 
bool sp_artistbrowse_is_loaded (sp_artistbrowse *arb)
 
sp_error sp_artistbrowse_error (sp_artistbrowse *arb)
 
sp_artistsp_artistbrowse_artist (sp_artistbrowse *arb)
 
int sp_artistbrowse_num_portraits (sp_artistbrowse *arb)
 
const byte * sp_artistbrowse_portrait (sp_artistbrowse *arb, int index)
 
int sp_artistbrowse_num_tracks (sp_artistbrowse *arb)
 
sp_tracksp_artistbrowse_track (sp_artistbrowse *arb, int index)
 
int sp_artistbrowse_num_tophit_tracks (sp_artistbrowse *arb)
 
sp_tracksp_artistbrowse_tophit_track (sp_artistbrowse *arb, int index)
 
int sp_artistbrowse_num_albums (sp_artistbrowse *arb)
 
sp_albumsp_artistbrowse_album (sp_artistbrowse *arb, int index)
 
int sp_artistbrowse_num_similar_artists (sp_artistbrowse *arb)
 
sp_artistsp_artistbrowse_similar_artist (sp_artistbrowse *arb, int index)
 
const char * sp_artistbrowse_biography (sp_artistbrowse *arb)
 
int sp_artistbrowse_backend_request_duration (sp_artistbrowse *arb)
 
sp_error sp_artistbrowse_add_ref (sp_artistbrowse *arb)
 
sp_error sp_artistbrowse_release (sp_artistbrowse *arb)
 

Detailed Description

Artist browsing initiates the fetching of information for a certain artist.

Note
There is currently no built-in functionality available for getting the albums belonging to an artist. For now, just iterate over all tracks and note the album to build a list of all albums. This feature will be added in a future version of the library.

Typedef Documentation

typedef void artistbrowse_complete_cb(sp_artistbrowse *result, void *userdata)

The type of a callback used in sp_artistbrowse_create()

When the callback is called, the metadata of all tracks belonging to it will have been loaded, so sp_track_is_loaded() will return non-zero. The same goes for the similar artist data.

Parameters
[in]resultThe same pointer returned by sp_artistbrowse_create()
[in]userdataThe opaque pointer given to sp_artistbrowse_create()

Function Documentation

sp_error sp_artistbrowse_add_ref ( sp_artistbrowse arb)

Increase the reference count of an artist browse result

Parameters
[in]arbThe artist browse result object
Returns
One of the following errors, from sp_error SP_ERROR_OK
sp_album* sp_artistbrowse_album ( sp_artistbrowse arb,
int  index 
)

Given an artist browse object, return one of its albums

Parameters
[in]arbAlbum browse object
[in]indexThe index for the album. Should be in the interval [0, sp_artistbrowse_num_albums() - 1]
Returns
A album object, or NULL if the index is out of range.
See Also
Album subsystem
sp_artist* sp_artistbrowse_artist ( sp_artistbrowse arb)

Given an artist browse object, return a pointer to its artist object

Parameters
[in]arbArtist browse object
Returns
Artist object
Examples:
browse.c.
int sp_artistbrowse_backend_request_duration ( sp_artistbrowse arb)

Return the time (in ms) that was spent waiting for the Spotify backend to serve the request

Parameters
[in]arbArtist browse object
Returns
-1 if the request was served from the local cache If the result is not yet loaded the return value is undefined
const char* sp_artistbrowse_biography ( sp_artistbrowse arb)

Given an artist browse object, return the artists biography

Note
This function must be called from the same thread that did sp_session_create()
Parameters
[in]arbArtist browse object
Returns
Biography string in UTF-8 format. Returned string is valid as long as the album object stays allocated and no longer than the next call to sp_session_process_events()
Examples:
browse.c.
sp_artistbrowse* sp_artistbrowse_create ( sp_session session,
sp_artist artist,
sp_artistbrowse_type  type,
artistbrowse_complete_cb callback,
void *  userdata 
)

Initiate a request for browsing an artist

The user is responsible for freeing the returned artist browse using sp_artistbrowse_release(). This can be done in the callback.

Parameters
[in]sessionSession object
[in]artistArtist to be browsed. The artist metadata does not have to be loaded
[in]typeType of data requested, see the sp_artistbrowse_type enum for details
[in]callbackCallback to be invoked when browsing has been completed. Pass NULL if you are not interested in this event.
[in]userdataUserdata passed to callback.
Returns
Artist browse object
See Also
artistbrowse_complete_cb
Examples:
browse.c.
sp_error sp_artistbrowse_error ( sp_artistbrowse arb)

Check if browsing returned an error code.

Parameters
[in]arbArtist browse object
Returns
One of the following errors, from sp_error SP_ERROR_OK SP_ERROR_IS_LOADING SP_ERROR_OTHER_PERMANENT SP_ERROR_OTHER_TRANSIENT
Examples:
browse.c.
bool sp_artistbrowse_is_loaded ( sp_artistbrowse arb)

Check if an artist browse request is completed

Parameters
[in]arbArtist browse object
Returns
True if browsing is completed, false if not
int sp_artistbrowse_num_albums ( sp_artistbrowse arb)

Given an artist browse object, return number of albums

Parameters
[in]arbArtist browse object
Returns
Number of albums for given artist
int sp_artistbrowse_num_portraits ( sp_artistbrowse arb)

Given an artist browse object, return number of portraits available

Parameters
[in]arbArtist browse object
Returns
Number of portraits for given artist
Examples:
browse.c.
int sp_artistbrowse_num_similar_artists ( sp_artistbrowse arb)

Given an artist browse object, return number of similar artists

Parameters
[in]arbArtist browse object
Returns
Number of similar artists for given artist
Examples:
browse.c.
int sp_artistbrowse_num_tophit_tracks ( sp_artistbrowse arb)

Given an artist browse object, return number of tophit tracks This is a set of tracks for the artist with highest popularity

Parameters
[in]arbArtist browse object
Returns
Number of tophit tracks for given artist
int sp_artistbrowse_num_tracks ( sp_artistbrowse arb)

Given an artist browse object, return number of tracks

Parameters
[in]arbArtist browse object
Returns
Number of tracks for given artist
Examples:
browse.c.
const byte* sp_artistbrowse_portrait ( sp_artistbrowse arb,
int  index 
)

Return image ID representing a portrait of the artist

Parameters
[in]arbArtist object
[in]indexThe index of the portrait. Should be in the interval [0, sp_artistbrowse_num_portraits() - 1]
Returns
ID byte sequence that can be passed to sp_image_create()
See Also
sp_image_create
sp_error sp_artistbrowse_release ( sp_artistbrowse arb)

Decrease the reference count of an artist browse result

Parameters
[in]arbThe artist browse result object
Returns
One of the following errors, from sp_error SP_ERROR_OK
Examples:
browse.c.
sp_artist* sp_artistbrowse_similar_artist ( sp_artistbrowse arb,
int  index 
)

Given an artist browse object, return a similar artist by index

Parameters
[in]arbAlbum browse object
[in]indexThe index for the artist. Should be in the interval [0, sp_artistbrowse_num_similar_artists() - 1]
Returns
A pointer to an artist object.
See Also
Artist subsystem
Examples:
browse.c.
sp_track* sp_artistbrowse_tophit_track ( sp_artistbrowse arb,
int  index 
)

Given an artist browse object, return one of its tophit tracks This is a set of tracks for the artist with highest popularity

Parameters
[in]arbAlbum browse object
[in]indexThe index for the track. Should be in the interval [0, sp_artistbrowse_num_tophit_tracks() - 1]
Returns
A track object, or NULL if the index is out of range.
See Also
Track subsystem
sp_track* sp_artistbrowse_track ( sp_artistbrowse arb,
int  index 
)

Given an artist browse object, return one of its tracks

Parameters
[in]arbAlbum browse object
[in]indexThe index for the track. Should be in the interval [0, sp_artistbrowse_num_tracks() - 1]
Returns
A track object, or NULL if the index is out of range.
See Also
Track subsystem
Examples:
browse.c.

Generated on Tue Jun 4 2013 15:11:47.
Copyright © 2006–2013 Spotify Ltd