Typedefs | |
typedef void | search_complete_cb (sp_search *result, void *userdata) |
Functions | |
sp_search * | sp_search_create (sp_session *session, const char *query, int offset, int count, search_complete_cb *callback, void *userdata) |
bool | sp_search_is_loaded (sp_search *search) |
sp_error | sp_search_error (sp_search *search) |
int | sp_search_num_tracks (sp_search *search) |
sp_track * | sp_search_track (sp_search *search, int index) |
int | sp_search_num_albums (sp_search *search) |
sp_album * | sp_search_album (sp_search *search, int index) |
int | sp_search_num_artists (sp_search *search) |
sp_artist * | sp_search_artist (sp_search *search, int index) |
const char * | sp_search_query (sp_search *search) |
const char * | sp_search_did_you_mean (sp_search *search) |
int | sp_search_total_tracks (sp_search *search) |
void | sp_search_add_ref (sp_search *search) |
void | sp_search_release (sp_search *search) |
typedef void search_complete_cb(sp_search *result, void *userdata) |
The type of a callback used in sp_search_create()
When this callback is called, the sp_track_is_loaded(), sp_album_is_loaded(), and sp_artist_is_loaded() functions will return non-zero for the objects contained in the search result.
[in] | result | The same pointer returned by sp_search_create() |
[in] | userdata | The opaque pointer given to sp_search_create() |
void sp_search_add_ref | ( | sp_search * | search | ) |
Increase the reference count of a search result
[in] | search | The search result object |
Return the album at the given index in the given search object
[in] | search | Search object |
[in] | index | Index of the wanted album. Should be in the interval [0, sp_search_num_albums() - 1] |
Return the artist at the given index in the given search object
[in] | search | Search object |
[in] | index | Index of the wanted artist. Should be in the interval [0, sp_search_num_artists() - 1] |
sp_search* sp_search_create | ( | sp_session * | session, | |
const char * | query, | |||
int | offset, | |||
int | count, | |||
search_complete_cb * | callback, | |||
void * | userdata | |||
) |
Create a search object from the given query
Here is a snippet from search.c:
g_search = sp_search_create(session, "year:2003 never", 0, 10, &search_complete, NULL); if (!g_search) { fprintf(stderr, "failed to start search\n"); g_exit_code = 6; return; }
[in] | session | Session |
[in] | query | Query search string, e.g. 'The Rolling Stones' or 'album:"The Black Album"' |
[in] | offset | The offset in the total number of results available |
[in] | count | The number of results to ask for |
[in] | callback | Callback that will be called once the search operation is complete. Pass NULL if you are not interested in this event. |
[in] | userdata | Opaque pointer passed to callback |
const char* sp_search_did_you_mean | ( | sp_search * | search | ) |
Return the "Did you mean" query for the given search object
[in] | search | Search object |
Check if search returned an error code.
[in] | search | Search object |
bool sp_search_is_loaded | ( | sp_search * | search | ) |
Get load status for the specified search. Before it is loaded, it will behave as an empty search result.
[in] | search | Search object |
int sp_search_num_albums | ( | sp_search * | search | ) |
Get the number of albums for the specified search
[in] | search | Search object |
int sp_search_num_artists | ( | sp_search * | search | ) |
Get the number of artists for the specified search
[in] | search | Search object |
int sp_search_num_tracks | ( | sp_search * | search | ) |
Get the number of tracks for the specified search
[in] | search | Search object |
const char* sp_search_query | ( | sp_search * | search | ) |
Return the search query for the given search object
[in] | search | Search object |
void sp_search_release | ( | sp_search * | search | ) |
Decrease the reference count of a search result
[in] | search | The search result object |
int sp_search_total_tracks | ( | sp_search * | search | ) |
Return the total number of tracks for the search query - regardless of the interval requested at creation. If this value is larger than the interval specified at creation of the search object, more search results are available. To fetch these, create a new search object with a new interval.
[in] | search | Search object |
Return the track at the given index in the given search object
[in] | search | Search object |
[in] | index | Index of the wanted track. Should be in the interval [0, sp_search_num_tracks() - 1] |