Merge branch 'stickertypes' of https://github.com/jcorporation/MPD
This commit is contained in:
commit
39937be2e1
2
NEWS
2
NEWS
|
@ -10,7 +10,7 @@ ver 0.24 (not yet released)
|
|||
- show PCRE support in "config" response
|
||||
- apply Unicode normalization to case-insensitive filter expressions
|
||||
- stickers on playlists and some tag types
|
||||
- new commands "stickernames" and "playlistlength"
|
||||
- new commands "stickernames", "stickertypes" and "playlistlength"
|
||||
- new "search"/"find" filter "added-since"
|
||||
- allow range in listplaylist and listplaylistinfo
|
||||
- "sticker find" supports sort and window parameter and new sticker compare operators "eq", "lt" and "gt"
|
||||
|
|
|
@ -1579,6 +1579,9 @@ Examples:
|
|||
:command:`stickernames`
|
||||
Gets a list of uniq sticker names.
|
||||
|
||||
:command:`stickertypes`
|
||||
Shows a list of available sticker types.
|
||||
|
||||
Connection settings
|
||||
===================
|
||||
|
||||
|
|
|
@ -188,6 +188,7 @@ static constexpr struct command commands[] = {
|
|||
#ifdef ENABLE_SQLITE
|
||||
{ "sticker", PERMISSION_ADMIN, 3, -1, handle_sticker },
|
||||
{ "stickernames", PERMISSION_ADMIN, 0, 0, handle_sticker_names },
|
||||
{ "stickertypes", PERMISSION_ADMIN, 0, 0, handle_sticker_types },
|
||||
#endif
|
||||
{ "stop", PERMISSION_PLAYER, 0, 0, handle_stop },
|
||||
{ "subscribe", PERMISSION_READ, 1, 1, handle_subscribe },
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -14,5 +14,7 @@ CommandResult
|
|||
handle_sticker(Client &client, Request request, Response &response);
|
||||
CommandResult
|
||||
handle_sticker_names(Client &client, Request request, Response &response);
|
||||
CommandResult
|
||||
handle_sticker_types(Client &client, Request request, Response &response);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue