diff --git a/NEWS b/NEWS index 6f6080135..ac1849b86 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.24 (not yet released) +* protocol + - "playlistfind"/"playlistsearch" have a "window" parameter * player - add option "mixramp_analyzer" to scan MixRamp tags on-the-fly * tags diff --git a/doc/protocol.rst b/doc/protocol.rst index d097f7a50..32e9e5d07 100644 --- a/doc/protocol.rst +++ b/doc/protocol.rst @@ -773,10 +773,15 @@ Whenever possible, ids should be used. .. _command_playlistfind: -:command:`playlistfind {FILTER}` +:command:`playlistfind {FILTER} [window {START:END}]` Search the queue for songs matching ``FILTER`` (see :ref:`Filters `). + ``window`` can be used to query only a portion of the real + response. The parameter is two zero-based queue positions; a + start index (including) and an end index (excluding). The end + index can be omitted, which means the range is open-ended. + .. _command_playlistid: :command:`playlistid {SONGID}` @@ -794,7 +799,7 @@ Whenever possible, ids should be used. .. _command_playlistsearch: -:command:`playlistsearch {FILTER}` +:command:`playlistsearch {FILTER} [window {START:END}]` Search the queue for songs matching ``FILTER`` (see :ref:`Filters `). Parameters have the same meaning as for :ref:`find diff --git a/src/command/QueueCommands.cxx b/src/command/QueueCommands.cxx index 140dc72ca..65debdc60 100644 --- a/src/command/QueueCommands.cxx +++ b/src/command/QueueCommands.cxx @@ -290,6 +290,14 @@ static CommandResult handle_playlist_match(Client &client, Request args, Response &r, bool fold_case) { + RangeArg window = RangeArg::All(); + if (args.size >= 2 && StringIsEqual(args[args.size - 2], "window")) { + window = args.ParseRange(args.size - 1); + + args.pop_back(); + args.pop_back(); + } + SongFilter filter; try { filter.Parse(args, fold_case); @@ -302,6 +310,7 @@ handle_playlist_match(Client &client, Request args, Response &r, QueueSelection selection; selection.filter = &filter; + selection.window = window; playlist_print_find(r, client.GetPlaylist(), selection); return CommandResult::OK;