Added "searchcount" command, a case-insensitive "count"
The `count` command isn't case-insensitive. This adds `searchcount` which is a case-insensitive version of `count`.
This commit is contained in:
parent
8b1ff3f005
commit
6adff85fd6
1
NEWS
1
NEWS
@ -1,5 +1,6 @@
|
|||||||
ver 0.24 (not yet released)
|
ver 0.24 (not yet released)
|
||||||
* protocol
|
* protocol
|
||||||
|
- new command "searchcount" (case-insensitive "count")
|
||||||
- "playlistfind"/"playlistsearch" have "sort" and "window" parameters
|
- "playlistfind"/"playlistsearch" have "sort" and "window" parameters
|
||||||
- "save" can append to or replace an existing playlist
|
- "save" can append to or replace an existing playlist
|
||||||
- filter "prio" (for "playlistfind"/"playlistsearch")
|
- filter "prio" (for "playlistfind"/"playlistsearch")
|
||||||
|
@ -1286,6 +1286,16 @@ The music database
|
|||||||
The ``position`` parameter specifies where the songs will be
|
The ``position`` parameter specifies where the songs will be
|
||||||
inserted. [#since_0_23_4]_
|
inserted. [#since_0_23_4]_
|
||||||
|
|
||||||
|
.. _command_searchcount:
|
||||||
|
|
||||||
|
:command:`searchcount {FILTER} [group {GROUPTYPE}]`
|
||||||
|
Count the number of songs and their total playtime in
|
||||||
|
the database matching ``FILTER`` (see
|
||||||
|
:ref:`Filters <filter_syntax>`).
|
||||||
|
|
||||||
|
Parameters have the same meaning as for :ref:`count <command_search>`
|
||||||
|
except the search is not case sensitive.
|
||||||
|
|
||||||
.. _command_update:
|
.. _command_update:
|
||||||
|
|
||||||
:command:`update [URI]`
|
:command:`update [URI]`
|
||||||
|
@ -189,6 +189,7 @@ static constexpr struct command commands[] = {
|
|||||||
{ "search", PERMISSION_READ, 1, -1, handle_search },
|
{ "search", PERMISSION_READ, 1, -1, handle_search },
|
||||||
{ "searchadd", PERMISSION_ADD, 1, -1, handle_searchadd },
|
{ "searchadd", PERMISSION_ADD, 1, -1, handle_searchadd },
|
||||||
{ "searchaddpl", PERMISSION_CONTROL, 2, -1, handle_searchaddpl },
|
{ "searchaddpl", PERMISSION_CONTROL, 2, -1, handle_searchaddpl },
|
||||||
|
{ "searchcount", PERMISSION_READ, 1, -1, handle_searchcount },
|
||||||
#endif
|
#endif
|
||||||
{ "seek", PERMISSION_PLAYER, 2, 2, handle_seek },
|
{ "seek", PERMISSION_PLAYER, 2, 2, handle_seek },
|
||||||
{ "seekcur", PERMISSION_PLAYER, 1, 1, handle_seekcur },
|
{ "seekcur", PERMISSION_PLAYER, 1, 1, handle_seekcur },
|
||||||
|
@ -231,8 +231,8 @@ handle_searchaddpl(Client &client, Request args, Response &)
|
|||||||
return CommandResult::OK;
|
return CommandResult::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult
|
static CommandResult
|
||||||
handle_count(Client &client, Request args, Response &r)
|
handle_count_internal(Client &client, Request args, Response &r, bool fold_case)
|
||||||
{
|
{
|
||||||
TagType group = TAG_NUM_OF_ITEM_TYPES;
|
TagType group = TAG_NUM_OF_ITEM_TYPES;
|
||||||
if (args.size() >= 2 && StringIsEqual(args[args.size() - 2], "group")) {
|
if (args.size() >= 2 && StringIsEqual(args[args.size() - 2], "group")) {
|
||||||
@ -251,7 +251,7 @@ handle_count(Client &client, Request args, Response &r)
|
|||||||
SongFilter filter;
|
SongFilter filter;
|
||||||
if (!args.empty()) {
|
if (!args.empty()) {
|
||||||
try {
|
try {
|
||||||
filter.Parse(args, false);
|
filter.Parse(args, fold_case);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
r.Error(ACK_ERROR_ARG,
|
r.Error(ACK_ERROR_ARG,
|
||||||
GetFullMessage(std::current_exception()).c_str());
|
GetFullMessage(std::current_exception()).c_str());
|
||||||
@ -265,6 +265,18 @@ handle_count(Client &client, Request args, Response &r)
|
|||||||
return CommandResult::OK;
|
return CommandResult::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CommandResult
|
||||||
|
handle_count(Client &client, Request args, Response &r)
|
||||||
|
{
|
||||||
|
return handle_count_internal(client, args, r, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
CommandResult
|
||||||
|
handle_searchcount(Client &client, Request args, Response &r)
|
||||||
|
{
|
||||||
|
return handle_count_internal(client, args, r, true);
|
||||||
|
}
|
||||||
|
|
||||||
CommandResult
|
CommandResult
|
||||||
handle_listall(Client &client, Request args, Response &r)
|
handle_listall(Client &client, Request args, Response &r)
|
||||||
{
|
{
|
||||||
|
@ -47,6 +47,9 @@ handle_searchadd(Client &client, Request request, Response &response);
|
|||||||
CommandResult
|
CommandResult
|
||||||
handle_searchaddpl(Client &client, Request request, Response &response);
|
handle_searchaddpl(Client &client, Request request, Response &response);
|
||||||
|
|
||||||
|
CommandResult
|
||||||
|
handle_searchcount(Client &client, Request request, Response &response);
|
||||||
|
|
||||||
CommandResult
|
CommandResult
|
||||||
handle_count(Client &client, Request request, Response &response);
|
handle_count(Client &client, Request request, Response &response);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user