Typedefs | Functions

Search subsystem

Typedefs

typedef void search_complete_cb (sp_search *result, void *userdata)

Functions

sp_searchsp_search_create (sp_session *session, const char *query, int track_offset, int track_count, int album_offset, int album_count, int artist_offset, int artist_count, int playlist_offset, int playlist_count, sp_search_type search_type, 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_tracksp_search_track (sp_search *search, int index)
int sp_search_num_albums (sp_search *search)
sp_albumsp_search_album (sp_search *search, int index)
int sp_search_num_playlists (sp_search *search)
sp_playlistsp_search_playlist (sp_search *search, int index)
const char * sp_search_playlist_name (sp_search *search, int index)
const char * sp_search_playlist_uri (sp_search *search, int index)
const char * sp_search_playlist_image_uri (sp_search *search, int index)
int sp_search_num_artists (sp_search *search)
sp_artistsp_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)
int sp_search_total_albums (sp_search *search)
int sp_search_total_artists (sp_search *search)
int sp_search_total_playlists (sp_search *search)
sp_error sp_search_add_ref (sp_search *search)
sp_error sp_search_release (sp_search *search)

Typedef Documentation

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.

Parameters:
[in] result The same pointer returned by sp_search_create()
[in] userdata The opaque pointer given to sp_search_create()

Function Documentation

sp_error sp_search_add_ref ( sp_search search  ) 

Increase the reference count of a search result

Parameters:
[in] search The search result object
Returns:
One of the following errors, from sp_error SP_ERROR_OK
sp_album* sp_search_album ( sp_search search,
int  index 
)

Return the album at the given index in the given search object

Parameters:
[in] search Search object
[in] index Index of the wanted album. Should be in the interval [0, sp_search_num_albums() - 1]
Returns:
The album at the given index in the given search object
Examples:
search.c.
sp_artist* sp_search_artist ( sp_search search,
int  index 
)

Return the artist at the given index in the given search object

Parameters:
[in] search Search object
[in] index Index of the wanted artist. Should be in the interval [0, sp_search_num_artists() - 1]
Returns:
The artist at the given index in the given search object
Examples:
search.c.
sp_search* sp_search_create ( sp_session session,
const char *  query,
int  track_offset,
int  track_count,
int  album_offset,
int  album_count,
int  artist_offset,
int  artist_count,
int  playlist_offset,
int  playlist_count,
sp_search_type  search_type,
search_complete_cb callback,
void *  userdata 
)

Create a search object from the given query

Parameters:
[in] session Session
[in] query Query search string, e.g. 'The Rolling Stones' or 'album:"The Black Album"'
[in] track_offset The offset among the tracks of the result
[in] track_count The number of tracks to ask for
[in] album_offset The offset among the albums of the result
[in] album_count The number of albums to ask for
[in] artist_offset The offset among the artists of the result
[in] artist_count The number of artists to ask for
[in] playlist_offset The offset among the playlists of the result
[in] playlist_count The number of playlists to ask for
[in] search_type Type of search, can be used for suggest searches
[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
Returns:
Pointer to a search object. To free the object, use sp_search_release()
Examples:
search.c.
const char* sp_search_did_you_mean ( sp_search search  ) 

Return the "Did you mean" query for the given search object

Parameters:
[in] search Search object
Returns:
The "Did you mean" query for the given search object, or the empty string if no such info is available
Examples:
search.c.
sp_error sp_search_error ( sp_search search  ) 

Check if search returned an error code.

Parameters:
[in] search Search 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:
search.c.
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.

Parameters:
[in] search Search object
Returns:
True if search is loaded, otherwise false
int sp_search_num_albums ( sp_search search  ) 

Get the number of albums for the specified search

Parameters:
[in] search Search object
Returns:
The number of albums for the specified search
Examples:
search.c.
int sp_search_num_artists ( sp_search search  ) 

Get the number of artists for the specified search

Parameters:
[in] search Search object
Returns:
The number of artists for the specified search
Examples:
search.c.
int sp_search_num_playlists ( sp_search search  ) 

Get the number of playlists for the specified search

Parameters:
[in] search Search object
Returns:
The number of playlists for the specified search
Examples:
search.c.
int sp_search_num_tracks ( sp_search search  ) 

Get the number of tracks for the specified search

Parameters:
[in] search Search object
Returns:
The number of tracks for the specified search
Examples:
search.c.
sp_playlist* sp_search_playlist ( sp_search search,
int  index 
)

Load the playlist at the given index in the given search object

Parameters:
[in] search Search object
[in] index Index of the wanted playlist. Should be in the interval [0, sp_search_num_playlists() - 1]
Returns:
A playlist object. This reference is owned by the caller and should be released with sp_playlist_release()
const char* sp_search_playlist_image_uri ( sp_search search,
int  index 
)

Return the image_uri of a playlist at the given index in the given search object

Parameters:
[in] search Search object
[in] index Index of the wanted playlist. Should be in the interval [0, sp_search_num_playlists() - 1]
Returns:
The playlist image_uri at the given index in the given search object
const char* sp_search_playlist_name ( sp_search search,
int  index 
)

Return the playlist at the given index in the given search object

Parameters:
[in] search Search object
[in] index Index of the wanted playlist. Should be in the interval [0, sp_search_num_playlists() - 1]
Returns:
The playlist name at the given index in the given search object
Examples:
search.c.
const char* sp_search_playlist_uri ( sp_search search,
int  index 
)

Return the uri of a playlist at the given index in the given search object

Parameters:
[in] search Search object
[in] index Index of the wanted playlist. Should be in the interval [0, sp_search_num_playlists() - 1]
Returns:
The playlist uri at the given index in the given search object
const char* sp_search_query ( sp_search search  ) 

Return the search query for the given search object

Parameters:
[in] search Search object
Returns:
The search query for the given search object
Examples:
search.c.
sp_error sp_search_release ( sp_search search  ) 

Decrease the reference count of a search result

Parameters:
[in] search The search result object
Returns:
One of the following errors, from sp_error SP_ERROR_OK
Examples:
search.c.
int sp_search_total_albums ( sp_search search  ) 

Return the total number of albums 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.

Parameters:
[in] search Search object
Returns:
The total number of albums matching the original query
int sp_search_total_artists ( sp_search search  ) 

Return the total number of artists 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.

Parameters:
[in] search Search object
Returns:
The total number of artists matching the original query
int sp_search_total_playlists ( sp_search search  ) 

Return the total number of playlists 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.

Parameters:
[in] search Search object
Returns:
The total number of playlists matching the original query
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.

Parameters:
[in] search Search object
Returns:
The total number of tracks matching the original query
Examples:
search.c.
sp_track* sp_search_track ( sp_search search,
int  index 
)

Return the track at the given index in the given search object

Parameters:
[in] search Search object
[in] index Index of the wanted track. Should be in the interval [0, sp_search_num_tracks() - 1]
Returns:
The track at the given index in the given search object
Examples:
search.c.

Generated on Wed Jun 13 2012 14:22:40.
Copyright © 2006–2012 Spotify Ltd