aboutsummaryrefslogtreecommitdiffstats
path: root/src/command
diff options
context:
space:
mode:
Diffstat (limited to 'src/command')
-rw-r--r--src/command/DatabaseCommands.cxx21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/command/DatabaseCommands.cxx b/src/command/DatabaseCommands.cxx
index 71ae3ec8a..23ff593a4 100644
--- a/src/command/DatabaseCommands.cxx
+++ b/src/command/DatabaseCommands.cxx
@@ -32,6 +32,8 @@
#include "SongFilter.hxx"
#include "protocol/Result.hxx"
+#include <string.h>
+
CommandResult
handle_listfiles_db(Client &client, const char *uri)
{
@@ -191,6 +193,7 @@ handle_list(Client &client, int argc, char *argv[])
}
SongFilter *filter = nullptr;
+ uint32_t group_mask = 0;
if (args.size == 1) {
/* for compatibility with < 0.12.0 */
@@ -204,6 +207,22 @@ handle_list(Client &client, int argc, char *argv[])
filter = new SongFilter((unsigned)TAG_ARTIST, args.shift());
}
+ while (args.size >= 2 &&
+ strcmp(args[args.size - 2], "group") == 0) {
+ const char *s = args[args.size - 1];
+ TagType gt = tag_name_parse_i(s);
+ if (gt == TAG_NUM_OF_ITEM_TYPES) {
+ command_error(client, ACK_ERROR_ARG,
+ "Unknown tag type: %s", s);
+ return CommandResult::ERROR;
+ }
+
+ group_mask |= 1u << unsigned(gt);
+
+ args.pop_back();
+ args.pop_back();
+ }
+
if (!args.IsEmpty()) {
filter = new SongFilter();
if (!filter->Parse(args, false)) {
@@ -216,7 +235,7 @@ handle_list(Client &client, int argc, char *argv[])
Error error;
CommandResult ret =
- listAllUniqueTags(client, tagType, filter, error)
+ listAllUniqueTags(client, tagType, group_mask, filter, error)
? CommandResult::OK
: print_error(client, error);