From df0c26a394be7dd4137c9614dd867122019d78f8 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 25 Aug 2009 13:43:22 +0200 Subject: command: add "findadd" command. --- src/dbUtils.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/dbUtils.c') diff --git a/src/dbUtils.c b/src/dbUtils.c index 67eb89ebe..88122649e 100644 --- a/src/dbUtils.c +++ b/src/dbUtils.c @@ -199,6 +199,28 @@ int addAllInToStoredPlaylist(const char *name, const char *utf8file) return db_walk(name, directoryAddSongToStoredPlaylist, NULL, &data); } +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) { -- cgit v1.2.3