Add command stickertypes

Prints all available stickertypes like tagtypes for tags.
This commit is contained in:
jcorporation
2024-08-14 20:53:41 +02:00
parent 965c466e9b
commit f94caa96b8
5 changed files with 26 additions and 1 deletions

View File

@@ -17,6 +17,7 @@
#include "Instance.hxx"
#include "util/StringAPI.hxx"
#include "util/ScopeExit.hxx"
#include "tag/Settings.hxx"
#include "tag/ParseName.hxx"
#include "tag/Names.hxx"
#include "sticker/TagSticker.hxx"
@@ -25,6 +26,7 @@
#include "db/PlaylistInfo.hxx"
#include "db/PlaylistVector.hxx"
#include "db/DatabaseLock.hxx"
#include <fmt/format.h>
#include "song/Filter.hxx"
namespace {
@@ -454,3 +456,20 @@ handle_sticker(Client &client, Request args, Response &r)
r.Error(ACK_ERROR_ARG, "bad request");
return CommandResult::ERROR;
}
CommandResult
handle_sticker_types(Client &client, Request args, Response &r)
{
(void) client;
(void) args;
const auto tag_mask = global_tag_mask & r.GetTagMask();
r.Fmt("stickertype: filter\n");
r.Fmt("stickertype: playlist\n");
r.Fmt("stickertype: song\n");
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++)
if (sticker_allowed_tags.Test(TagType(i)) &&
tag_mask.Test(TagType(i)))
r.Fmt(FMT_STRING("stickertype: {}\n"), tag_item_names[i]);
return CommandResult::OK;
}