From 92a75471505391edd2f8f9af23188b4f7b17bbcb Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Wed, 10 Nov 2004 01:09:03 +0000 Subject: begining of metadata rewrite: now we support genre and date metadata, along with multiple metadata entries for each type git-svn-id: https://svn.musicpd.org/mpd/branches/r2562-metadata-handling-rewrite@2567 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/directory.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/directory.c') diff --git a/src/directory.c b/src/directory.c index 0fa5e85f6..5ac94c534 100644 --- a/src/directory.c +++ b/src/directory.c @@ -1189,17 +1189,15 @@ int printSongInDirectory(FILE * fp, Song * song, void * data) { } static inline int strstrSearchTag(Song * song, int type, char * str) { - MpdTagItem * item; + int i; char * dup; if(!song->tag) return 0; - for(item = song->tag->tagItems; item && item->type!=TAG_ITEM_END; - item++) - { - if(item->type != type) continue; + for(i = 0; i < song->tag->numOfItems; i++) { + if(song->tag->items[i].type != type) continue; - dup = strDupToUpper(item->value); + dup = strDupToUpper(song->tag->items[i].value); if(strstr(dup, str)) return 1; free(dup); } @@ -1263,16 +1261,14 @@ int searchForSongsIn(FILE * fp, char * name, char * item, char * string) { } static inline int tagItemFoundAndMatches(Song * song, int type, char * str) { - MpdTagItem * item; + int i; if(!song->tag) return 0; - for(item = song->tag->tagItems; item && item->type != TAG_ITEM_END; - item++) - { - if(item->type != type) continue; + for(i = 0; i < song->tag->numOfItems; i++) { + if(song->tag->items[i].type != type) continue; - if( 0 == strcmp(str, item->value)) return 1; + if(0 == strcmp(str, song->tag->items[i].value)) return 1; } return 0; -- cgit v1.2.3