diff options
author | Max Kellermann <max@duempel.org> | 2012-08-07 23:22:37 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-08-08 00:55:02 +0200 |
commit | 733d6a6b16686c852b6d0fc0e4e9197add501a2f (patch) | |
tree | c089ab2961a5b98558f7587df3c5ef995628e8b3 /src/DatabaseQueue.cxx | |
parent | 8d2725234e6271434d87ecaac23ef882850e649a (diff) | |
download | mpd-733d6a6b16686c852b6d0fc0e4e9197add501a2f.tar.gz mpd-733d6a6b16686c852b6d0fc0e4e9197add501a2f.tar.xz mpd-733d6a6b16686c852b6d0fc0e4e9197add501a2f.zip |
DatabaseSelection: add "match" attribute
Let the database plugin do the match.
Diffstat (limited to '')
-rw-r--r-- | src/DatabaseQueue.cxx | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/DatabaseQueue.cxx b/src/DatabaseQueue.cxx index acbf90741..26ac2c6fd 100644 --- a/src/DatabaseQueue.cxx +++ b/src/DatabaseQueue.cxx @@ -23,7 +23,6 @@ extern "C" { #include "dbUtils.h" -#include "locate.h" #include "playlist.h" } @@ -47,31 +46,18 @@ AddToQueue(struct player_control *pc, song &song, GError **error_r) } bool -addAllIn(struct player_control *pc, const char *uri, GError **error_r) +findAddIn(struct player_control *pc, const char *uri, + const struct locate_item_list *criteria, GError **error_r) { - const DatabaseSelection selection(uri, true); + const DatabaseSelection selection(uri, true, criteria); using namespace std::placeholders; const auto f = std::bind(AddToQueue, pc, _1, _2); return GetDatabase()->Visit(selection, f, error_r); } -static bool -MatchAddSong(struct player_control *pc, - const struct locate_item_list *criteria, - song &song, GError **error_r) -{ - return !locate_list_song_match(&song, criteria) || - AddToQueue(pc, song, error_r); -} - bool -findAddIn(struct player_control *pc, const char *uri, - const struct locate_item_list *criteria, GError **error_r) +addAllIn(struct player_control *pc, const char *uri, GError **error_r) { - const DatabaseSelection selection(uri, true); - - using namespace std::placeholders; - const auto f = std::bind(MatchAddSong, pc, criteria, _1, _2); - return GetDatabase()->Visit(selection, f, error_r); + return findAddIn(pc, uri, nullptr, error_r); } |