aboutsummaryrefslogtreecommitdiffstats
path: root/src/DatabasePlaylist.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-08-07 23:22:37 +0200
committerMax Kellermann <max@duempel.org>2012-08-08 00:55:02 +0200
commit733d6a6b16686c852b6d0fc0e4e9197add501a2f (patch)
treec089ab2961a5b98558f7587df3c5ef995628e8b3 /src/DatabasePlaylist.cxx
parent8d2725234e6271434d87ecaac23ef882850e649a (diff)
downloadmpd-733d6a6b16686c852b6d0fc0e4e9197add501a2f.tar.gz
mpd-733d6a6b16686c852b6d0fc0e4e9197add501a2f.tar.xz
mpd-733d6a6b16686c852b6d0fc0e4e9197add501a2f.zip
DatabaseSelection: add "match" attribute
Let the database plugin do the match.
Diffstat (limited to 'src/DatabasePlaylist.cxx')
-rw-r--r--src/DatabasePlaylist.cxx30
1 files changed, 8 insertions, 22 deletions
diff --git a/src/DatabasePlaylist.cxx b/src/DatabasePlaylist.cxx
index bdd55fc5a..c6ad9c543 100644
--- a/src/DatabasePlaylist.cxx
+++ b/src/DatabasePlaylist.cxx
@@ -23,7 +23,6 @@
extern "C" {
#include "dbUtils.h"
-#include "locate.h"
#include "stored_playlist.h"
}
@@ -40,34 +39,21 @@ AddSong(const char *playlist_path_utf8,
}
bool
-addAllInToStoredPlaylist(const char *uri_utf8, const char *playlist_path_utf8,
- GError **error_r)
+search_add_to_playlist(const char *uri, const char *playlist_path_utf8,
+ const struct locate_item_list *criteria,
+ GError **error_r)
{
- const DatabaseSelection selection(uri_utf8, true);
+ const DatabaseSelection selection(uri, true, criteria);
using namespace std::placeholders;
const auto f = std::bind(AddSong, playlist_path_utf8, _1, _2);
return GetDatabase()->Visit(selection, f, error_r);
}
-static bool
-SearchAddSong(const char *playlist_path_utf8,
- const struct locate_item_list *criteria,
- song &song, GError **error_r)
-{
- return !locate_list_song_match(&song, criteria) ||
- spl_append_song(playlist_path_utf8, &song, error_r);
-}
-
bool
-search_add_to_playlist(const char *uri, const char *playlist_path_utf8,
- const struct locate_item_list *criteria,
- GError **error_r)
+addAllInToStoredPlaylist(const char *uri_utf8, const char *playlist_path_utf8,
+ GError **error_r)
{
- const DatabaseSelection selection(uri, true);
-
- using namespace std::placeholders;
- const auto f = std::bind(SearchAddSong, playlist_path_utf8,
- criteria, _1, _2);
- return GetDatabase()->Visit(selection, f, error_r);
+ return search_add_to_playlist(uri_utf8, playlist_path_utf8, nullptr,
+ error_r);
}