aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2005-02-28 23:57:47 +0000
committerWarren Dukes <warren.dukes@gmail.com>2005-02-28 23:57:47 +0000
commit349539740b81ae4447f94c45c697e873c97072ea (patch)
tree578f67b6100f388a0dc44f159c599cf69f77c3a5 /src
parent1f28c240973d36cfd51b190baff5ed1819e90a05 (diff)
downloadmpd-349539740b81ae4447f94c45c697e873c97072ea.tar.gz
mpd-349539740b81ae4447f94c45c697e873c97072ea.tar.xz
mpd-349539740b81ae4447f94c45c697e873c97072ea.zip
add "any" option for search and find, patch from Robert Andersson
git-svn-id: https://svn.musicpd.org/mpd/trunk@2997 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/dbUtils.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/dbUtils.c b/src/dbUtils.c
index 5878e6f0f..b90aff217 100644
--- a/src/dbUtils.c
+++ b/src/dbUtils.c
@@ -10,6 +10,9 @@
#define LOCATE_TAG_FILE_TYPE TAG_NUM_OF_ITEM_TYPES+10
#define LOCATE_TAG_FILE_KEY "filename"
+#define LOCATE_TAG_ANY_TYPE TAG_NUM_OF_ITEM_TYPES+20
+#define LOCATE_TAG_ANY_KEY "any"
+
typedef struct _ListCommandItem {
mpd_sint8 tagType;
@@ -29,6 +32,10 @@ int getLocateTagItemType(char * str) {
return LOCATE_TAG_FILE_TYPE;
}
+ if(0 == strcasecmp(str, LOCATE_TAG_ANY_KEY)) {
+ return LOCATE_TAG_ANY_TYPE;
+ }
+
for(i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++) {
if(0 == strcasecmp(str, mpdTagItemKeys[i])) return i;
}
@@ -127,17 +134,23 @@ static inline int strstrSearchTag(Song * song, int type, char * str) {
char * dup;
int ret = 0;
- if(type == LOCATE_TAG_FILE_TYPE) {
+ if(type == LOCATE_TAG_FILE_TYPE || type == LOCATE_TAG_ANY_TYPE) {
dup = strDupToUpper(getSongUrl(song));
if(strstr(dup, str)) ret = 1;
free(dup);
- return ret;
+ if (ret == 1 || type == LOCATE_TAG_FILE_TYPE) {
+ return ret;
+ }
}
if(!song->tag) return 0;
for(i = 0; i < song->tag->numOfItems && !ret; i++) {
- if(song->tag->items[i].type != type) continue;
+ if(type != LOCATE_TAG_ANY_TYPE &&
+ song->tag->items[i].type != type)
+ {
+ continue;
+ }
dup = strDupToUpper(song->tag->items[i].value);
if(strstr(dup, str)) ret = 1;