libmpd
0.19.0
|
Functions | |
void | mpd_database_search_add_constraint (MpdObj *mi, mpd_TagItems field, const char *value) |
void | mpd_database_search_start (MpdObj *mi, int exact) |
void | mpd_database_search_field_start (MpdObj *mi, mpd_TagItems field) |
MpdData * | mpd_database_search_commit (MpdObj *mi) |
The following functions provide an interface to the improved search capabilities of mpd 0.12.0.
void mpd_database_search_add_constraint | ( | MpdObj * | mi, |
mpd_TagItems | field, | ||
const char * | value | ||
) |
mi | A MpdObj |
field | A mpd_TagItems |
value | a string that field needs to match |
Adds a constraint to the search
void mpd_database_search_field_start | ( | MpdObj * | mi, |
mpd_TagItems | field | ||
) |
mi | a MpdObj |
field | a mpd_TagItems |
Starts a field search, eg. if you want a list of all albums, you do;
mpd_database_search_field_start(mi, MPD_TAG_ITEM_ALBUM); data = mpd_database_search_commit(mi);
You can add constraints using mpd_database_search_add_constraint, for example if you want all albums by eric clapton:
mpd_database_search_field_start(mi, MPD_TAG_ITEM_ALBUM); mpd_database_search_add_constraint(mi, MPD_TAG_ITEM_ARTIST, "Eric Clapton"); data = mpd_database_search_commit(mi);
void mpd_database_search_start | ( | MpdObj * | mi, |
int | exact | ||
) |
mi | A MpdObj |
exact | a boolean indicating if the search is fuzzy or exact |
Starts a search, you can add "constraints" by calling mpd_database_search_add_constraint For Example if you want all songs by Eric Clapton you could do:
mpd_database_search_start(mi, TRUE); mpd_database_search_add_constraint(mi, MPD_TAG_ITEM_ARTIST, "Eric Clapton"); data= mpd_database_search_commit(mi);
If you only want the songs from the album unplugged:
mpd_database_search_start(mi, TRUE); mpd_database_search_add_constraint(mi, MPD_TAG_ITEM_ARTIST, "Eric Clapton"); mpd_database_search_add_constraint(mi, MPD_TAG_ITEM_ALBUM, "Unplugged"); data= mpd_database_search_commit(mi);
This function requires mpd 0.12.0 or higher