aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbUtils.c
diff options
context:
space:
mode:
authorAnton Khirnov <wyskas@gmail.com>2009-08-25 13:43:22 +0200
committerMax Kellermann <max@duempel.org>2009-08-25 13:43:22 +0200
commitdf0c26a394be7dd4137c9614dd867122019d78f8 (patch)
tree7f7806e251104c6d473e6bba5be4a50ca6e84ffc /src/dbUtils.c
parent1e56c7b8629f5c11eee0680e4584030cac939ce8 (diff)
downloadmpd-df0c26a394be7dd4137c9614dd867122019d78f8.tar.gz
mpd-df0c26a394be7dd4137c9614dd867122019d78f8.tar.xz
mpd-df0c26a394be7dd4137c9614dd867122019d78f8.zip
command: add "findadd" command.
Diffstat (limited to 'src/dbUtils.c')
-rw-r--r--src/dbUtils.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/dbUtils.c b/src/dbUtils.c
index 67eb89ebe..88122649e 100644
--- a/src/dbUtils.c
+++ b/src/dbUtils.c
@@ -200,6 +200,28 @@ int addAllInToStoredPlaylist(const char *name, const char *utf8file)
}
static int
+findAddInDirectory(struct song *song, void *_data)
+{
+ struct search_data *data = _data;
+
+ if (locate_song_match(song, data->criteria))
+ return directoryAddSongToPlaylist(song, data);
+
+ return 0;
+}
+
+int findAddIn(struct client *client, const char *name,
+ const struct locate_item_list *criteria)
+{
+ struct search_data data;
+
+ data.client = client;
+ data.criteria = criteria;
+
+ return db_walk(name, findAddInDirectory, NULL, &data);
+}
+
+static int
directoryPrintSongInfo(struct song *song, void *data)
{
struct client *client = data;