Skip to content

Commit

Permalink
Change the semantic of the searchplaylist protocol command
Browse files Browse the repository at this point in the history
Old: searchplaylist {NAME} {FILTER} [{START:END}]
New: searchplaylist {NAME} {FILTER} [window {START:END}]

This is more similar to the other search commands and we can reuse search specific functions in libmpdclient.
  • Loading branch information
jcorporation committed Aug 30, 2024
1 parent a3a0728 commit 3f718e8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/protocol.rst
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ remote playlists (absolute URI with a supported scheme).

.. _command_searchplaylist:

:command:`searchplaylist {NAME} {FILTER} [{START:END}]`
:command:`searchplaylist {NAME} {FILTER} [window {START:END}]`
Search the playlist for songs matching
``FILTER`` (see :ref:`Filters <filter_syntax>`). Playlist
plugins are supported. A range may be specified to list
Expand Down
2 changes: 1 addition & 1 deletion src/command/AllCommands.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static constexpr struct command commands[] = {
{ "searchaddpl", PERMISSION_CONTROL, 2, -1, handle_searchaddpl },
{ "searchcount", PERMISSION_READ, 1, -1, handle_searchcount },
#endif
{ "searchplaylist", PERMISSION_READ, 2, 3, handle_searchplaylist },
{ "searchplaylist", PERMISSION_READ, 2, 4, handle_searchplaylist },
{ "seek", PERMISSION_PLAYER, 2, 2, handle_seek },
{ "seekcur", PERMISSION_PLAYER, 1, 1, handle_seekcur },
{ "seekid", PERMISSION_PLAYER, 2, 2, handle_seekid },
Expand Down
4 changes: 3 additions & 1 deletion src/command/PlaylistCommands.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,10 @@ handle_searchplaylist(Client &client, Request args, Response &r)
args.shift();

RangeArg window = RangeArg::All();
if (args.size() == 2) {
if (args.size() == 3 && StringIsEqual(args[args.size() - 2], "window")) {
window = args.ParseRange(args.size() - 1);

args.pop_back();
args.pop_back();
}

Expand Down

0 comments on commit 3f718e8

Please sign in to comment.