aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-11-10 20:11:34 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-11-10 20:11:34 +0000
commit0337ec851c643503afd2287f03ca42b5adf5cad7 (patch)
tree0b6ead2f83f5b9e390cdff163bafb5fe9e6e4bfc /src/command.c
parent0e8aa9674f10a6ca1ad69b3846b5a4b5e9188928 (diff)
downloadmpd-0337ec851c643503afd2287f03ca42b5adf5cad7.tar.gz
mpd-0337ec851c643503afd2287f03ca42b5adf5cad7.tar.xz
mpd-0337ec851c643503afd2287f03ca42b5adf5cad7.zip
search/find rewrite
git-svn-id: https://svn.musicpd.org/mpd/branches/r2562-metadata-handling-rewrite@2584 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/command.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/command.c b/src/command.c
index a179c2af4..35045b472 100644
--- a/src/command.c
+++ b/src/command.c
@@ -31,6 +31,7 @@
#include "audio.h"
#include "buffer2array.h"
#include "log.h"
+#include "dbUtils.h"
#include <stdlib.h>
#include <string.h>
@@ -441,13 +442,41 @@ int handlePlaylistId(FILE * fp, unsigned int * permission,
int handleFind(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
- return findSongsIn(fp,NULL,argArray[1],argArray[2]);
+ int ret;
+
+ LocateTagItem * item = newLocateTagItem(argArray[1], argArray[2]);
+
+ if(!item) {
+ commandError(fp, ACK_ERROR_ARG, "\%s\" isn't recognized",
+ argArray[1]);
+ return -1;
+ }
+
+ ret = findSongsIn(fp, NULL, item);
+
+ freeLocateTagItem(item);
+
+ return ret;
}
int handleSearch(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
- return searchForSongsIn(fp,NULL,argArray[1],argArray[2]);
+ int ret;
+
+ LocateTagItem * item = newLocateTagItem(argArray[1], argArray[2]);
+
+ if(!item) {
+ commandError(fp, ACK_ERROR_ARG, "\%s\" isn't recognized",
+ argArray[1]);
+ return -1;
+ }
+
+ ret = searchForSongsIn(fp, NULL, item);
+
+ freeLocateTagItem(item);
+
+ return ret;
}
int listHandleUpdate(FILE * fp, unsigned int * permission, int argArrayLength,