aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbUtils.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/dbUtils.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/dbUtils.c b/src/dbUtils.c
index 9eb6aa46b..d204d7e1e 100644
--- a/src/dbUtils.c
+++ b/src/dbUtils.c
@@ -25,7 +25,7 @@
#include "song.h"
#include "song_print.h"
#include "tag.h"
-#include "tagTracker.h"
+#include "strset.h"
#include "log.h"
#include "storedPlaylist.h"
@@ -278,7 +278,8 @@ static void freeListCommandItem(ListCommandItem * item)
free(item);
}
-static void visitTag(struct client *client, Song * song, enum tag_type tagType)
+static void visitTag(struct client *client, struct strset *set,
+ Song * song, enum tag_type tagType)
{
int i;
struct tag *tag = song->tag;
@@ -293,7 +294,7 @@ static void visitTag(struct client *client, Song * song, enum tag_type tagType)
for (i = 0; i < tag->numOfItems; i++) {
if (tag->items[i]->type == tagType) {
- visitInTagTracker(tagType, tag->items[i]->value);
+ strset_add(set, tag->items[i]->value);
}
}
}
@@ -301,6 +302,7 @@ static void visitTag(struct client *client, Song * song, enum tag_type tagType)
struct list_tags_data {
struct client *client;
ListCommandItem *item;
+ struct strset *set;
};
static int listUniqueTagsInDirectory(Song * song, void *_data)
@@ -310,7 +312,7 @@ static int listUniqueTagsInDirectory(Song * song, void *_data)
if (tagItemsFoundAndMatches(song, item->numConditionals,
item->conditionals)) {
- visitTag(data->client, song, item->tagType);
+ visitTag(data->client, data->set, song, item->tagType);
}
return 0;
@@ -328,14 +330,23 @@ int listAllUniqueTags(struct client *client, int type, int numConditionals,
};
if (type >= 0 && type <= TAG_NUM_OF_ITEM_TYPES) {
- resetVisitedFlagsInTagTracker(type);
+ data.set = strset_new();
}
ret = traverseAllIn(NULL, listUniqueTagsInDirectory, NULL,
&data);
if (type >= 0 && type <= TAG_NUM_OF_ITEM_TYPES) {
- printVisitedInTagTracker(client, type);
+ const char *value;
+
+ strset_rewind(data.set);
+
+ while ((value = strset_next(data.set)) != NULL)
+ client_printf(client, "%s: %s\n",
+ mpdTagItemKeys[type],
+ value);
+
+ strset_free(data.set);
}
freeListCommandItem(item);