From 4e8b5f5d413059f013d43d87eab30a5d3540ed5a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 3 Oct 2009 18:20:47 +0200 Subject: [PATCH] screen_artist: don't use mpdclient_filelist_search() Use libmpdclient directly. Side effect is that the listing of an album includes the artist filter, too. Same album name of different artists doesn't mix anymore. --- src/screen_artist.c | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/src/screen_artist.c b/src/screen_artist.c index bda8970..11bd468 100644 --- a/src/screen_artist.c +++ b/src/screen_artist.c @@ -189,23 +189,25 @@ load_album_list(struct mpdclient *c) static void load_song_list(struct mpdclient *c) { + struct mpd_connection *connection = c->connection; + assert(mode == LIST_SONGS); assert(artist != NULL); assert(album != NULL); assert(browser.filelist == NULL); - if (album[0] == 0) - browser.filelist = - mpdclient_filelist_search(c, TRUE, - MPD_TAG_ARTIST, - artist); - else - browser.filelist = - mpdclient_filelist_search(c, TRUE, - MPD_TAG_ALBUM, - album); - if (browser.filelist == NULL) - browser.filelist = filelist_new(); + mpd_search_db_songs(connection, true); + mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT, + MPD_TAG_ARTIST, artist); + if (album[0] != 0) + mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT, + MPD_TAG_ALBUM, album); + mpd_search_commit(connection); + + browser.filelist = filelist_new_recv(connection); + + if (!mpd_response_finish(connection)) + mpdclient_handle_error(c); /* add a dummy entry for ".." */ filelist_prepend(browser.filelist, NULL); @@ -389,6 +391,7 @@ screen_artist_update(struct mpdclient *c) static void add_query(struct mpdclient *c, enum mpd_tag_type table, char *_filter) { + struct mpd_connection *connection = c->connection; char *str; struct filelist *addlist; @@ -401,11 +404,19 @@ add_query(struct mpdclient *c, enum mpd_tag_type table, char *_filter) screen_status_printf("Adding %s...", str); g_free(str); - addlist = mpdclient_filelist_search(c, TRUE, table, _filter); - if (addlist) { + mpd_search_db_songs(connection, true); + mpd_search_add_tag_constraint(connection, MPD_OPERATOR_DEFAULT, + table, _filter); + mpd_search_commit(connection); + + addlist = filelist_new_recv(connection); + + if (mpd_response_finish(connection)) mpdclient_filelist_add_all(c, addlist); - filelist_free(addlist); - } + else + mpdclient_handle_error(c); + + filelist_free(addlist); } static unsigned -- 2.30.2