Qball's Weblog

Libmpd updates

Tags gmpc 

I haven’t done allot on libmpd in the last few month, mostly because it worked fine, but the last few days I did some updates. I am still very happy I wrote it. It’s just an extra abstraction layer, but for me useful.
Most noticeable update is the change where I move from a va_list system to multiple calls system.

This:

data = mpd_database_get_unique_tags(connection,MPD_TAG_ITEM_ARTIST, MPD_TAG_ITEM_ALBUM,first_tag,-1 );

To this:

mpd_database_search_field_start(connection,MPD_TAG_ITEM_ARTIST);
mpd_database_search_add_constraint(connection, MPD_TAG_ITEM_ALBUM,first_tag);
data = mpd_database_search_commit(connection);

The ‘mpd_database_search_commit’ and ‘mpd_database_search_add_constraint’ are also used for  other ‘search’ functions. This api might look less nice, but its easier (and nicer) to make searches with variable number of constraints. Further I fixed a small memory leak.

I hope this is the last “big” change in libmpd/gmpc before the next release, for now it’s (hopefully) going to be bug fixes and cleaning up some parts of the gui.  Especially the some preferences items need to cleaned up, because it still has options from past time.