#define SP_TOPLIST_REGION | ( | a, | ||
b | ||||
) | ((a) << 8 | (b)) |
Convenience macro to create a toplist region. Toplist regions are ISO 3166-1 country codes (in uppercase) encoded in an integer. There are also some reserved codes used to denote non-country regions. See sp_toplistregion
Example: SP_TOPLIST_REGION('S', 'E') for Sweden
typedef void toplistbrowse_complete_cb(sp_toplistbrowse *result, void *userdata) |
The type of a callback used in sp_toplistbrowse_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 toplist data.
[in] | result | The same pointer returned by sp_toplistbrowse_create() |
[in] | userdata | The opaque pointer given to sp_toplistbrowse_create() |
enum sp_toplistregion |
enum sp_toplisttype |
sp_error sp_toplistbrowse_add_ref | ( | sp_toplistbrowse * | tlb | ) |
Increase the reference count of an toplist browse result
[in] | tlb | The toplist browse result object |
sp_album* sp_toplistbrowse_album | ( | sp_toplistbrowse * | tlb, | |
int | index | |||
) |
Return the album at the given index in the given toplist browse object
[in] | tlb | Toplist object |
[in] | index | Index of the wanted album. Should be in the interval [0, sp_toplistbrowse_num_albums() - 1] |
sp_artist* sp_toplistbrowse_artist | ( | sp_toplistbrowse * | tlb, | |
int | index | |||
) |
Return the artist at the given index in the given toplist browse object
[in] | tlb | Toplist object |
[in] | index | Index of the wanted artist. Should be in the interval [0, sp_toplistbrowse_num_artists() - 1] |
int sp_toplistbrowse_backend_request_duration | ( | sp_toplistbrowse * | tlb | ) |
Return the time (in ms) that was spent waiting for the Spotify backend to serve the request
[in] | tlb | Toplist object |
sp_toplistbrowse* sp_toplistbrowse_create | ( | sp_session * | session, | |
sp_toplisttype | type, | |||
sp_toplistregion | region, | |||
const char * | username, | |||
toplistbrowse_complete_cb * | callback, | |||
void * | userdata | |||
) |
Initiate a request for browsing an toplist
The user is responsible for freeing the returned toplist browse using sp_toplistbrowse_release(). This can be done in the callback.
[in] | session | Session object |
[in] | type | Type of toplist to be browsed. see the sp_toplisttype enum for possible values |
[in] | region | Region. see sp_toplistregion enum. Country specific regions are coded as two chars in an integer. Sweden would correspond to 'S' << 8 | 'E' |
[in] | username | If region is SP_TOPLIST_REGION_USER this specifies which user to get toplists for. NULL means the logged in user. |
[in] | callback | Callback to be invoked when browsing has been completed. Pass NULL if you are not interested in this event. |
[in] | userdata | Userdata passed to callback. |
sp_error sp_toplistbrowse_error | ( | sp_toplistbrowse * | tlb | ) |
Check if browsing returned an error code.
[in] | tlb | Toplist browse object |
bool sp_toplistbrowse_is_loaded | ( | sp_toplistbrowse * | tlb | ) |
Check if an toplist browse request is completed
[in] | tlb | Toplist browse object |
int sp_toplistbrowse_num_albums | ( | sp_toplistbrowse * | tlb | ) |
Given an toplist browse object, return number of albums
[in] | tlb | Toplist browse object |
int sp_toplistbrowse_num_artists | ( | sp_toplistbrowse * | tlb | ) |
Given an toplist browse object, return number of artists
[in] | tlb | Toplist browse object |
int sp_toplistbrowse_num_tracks | ( | sp_toplistbrowse * | tlb | ) |
Given an toplist browse object, return number of tracks
[in] | tlb | Toplist browse object |
sp_error sp_toplistbrowse_release | ( | sp_toplistbrowse * | tlb | ) |
sp_track* sp_toplistbrowse_track | ( | sp_toplistbrowse * | tlb, | |
int | index | |||
) |
Return the track at the given index in the given toplist browse object
[in] | tlb | Toplist object |
[in] | index | Index of the wanted track. Should be in the interval [0, sp_toplistbrowse_num_tracks() - 1] |