aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbUtils.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-11-11 13:15:41 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-11-11 13:15:41 +0000
commitb9272fa95a2db87d499fde531124a977f62e194e (patch)
tree32d3f0e6b43c119ced5cb8d051fb0abd97b2883b /src/dbUtils.c
parent1d123cd496bd9c01586dcb8d75f48fc3c5e74532 (diff)
downloadmpd-b9272fa95a2db87d499fde531124a977f62e194e.tar.gz
mpd-b9272fa95a2db87d499fde531124a977f62e194e.tar.xz
mpd-b9272fa95a2db87d499fde531124a977f62e194e.zip
ok, tagtracker now tracks title, this has the disadvantage of needing to sort
the title tracker list, and it wastes more memory. But it makes implementing list command elegant, since we've just visit tags, then print out the visited tags in tag tracker (which has the benefit of making sure everything is in sorted order) git-svn-id: https://svn.musicpd.org/mpd/trunk@2608 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/dbUtils.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/dbUtils.c b/src/dbUtils.c
index 60344a291..dd698789c 100644
--- a/src/dbUtils.c
+++ b/src/dbUtils.c
@@ -213,7 +213,7 @@ void freeListCommandItem(ListCommandItem * item) {
free(item);
}
-void printUnvisitedTags(FILE * fp, Song * song, int tagType) {
+void visitTag(FILE * fp, Song * song, int tagType) {
int i;
MpdTag * tag = song->tag;
@@ -225,11 +225,8 @@ void printUnvisitedTags(FILE * fp, Song * song, int tagType) {
if(!tag) return;
for(i = 0; i < tag->numOfItems; i++) {
- if(tag->items[i].type == tagType &&
- !wasVisitedInTagTracker(tagType, tag->items[i].value))
- {
- myfprintf(fp, "%s: %s\n", mpdTagItemKeys[tagType],
- tag->items[i].value);
+ if(tag->items[i].type == tagType) {
+ visitInTagTracker(tagType, tag->items[i].value);
}
}
}
@@ -246,7 +243,7 @@ int listUniqueTagsInDirectory(FILE * fp, Song * song, void * data) {
}
}
- printUnvisitedTags(fp, song, item->tagType);
+ visitTag(fp, song, item->tagType);
return 0;
}
@@ -265,6 +262,10 @@ int listAllUniqueTags(FILE * fp, int type, int numConditionals,
ret = traverseAllIn(fp, NULL, listUniqueTagsInDirectory, NULL,
(void *)item);
+ if(type >= 0 && type <= TAG_NUM_OF_ITEM_TYPES) {
+ printVisitedInTagTracker(fp, type);
+ }
+
freeListCommandItem(item);
return ret;