Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
b1b630a4
Commit
b1b630a4
authored
Mar 25, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command/database: support "sort" and "window" in more commands
Closes
https://github.com/MusicPlayerDaemon/MPD/issues/516
parent
c60d374f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
29 deletions
+14
-29
NEWS
NEWS
+3
-0
protocol.rst
doc/protocol.rst
+3
-3
DatabaseCommands.cxx
src/command/DatabaseCommands.cxx
+8
-26
No files found.
NEWS
View file @
b1b630a4
ver 0.22 (not yet released)
* protocol
- "findadd"/"searchadd"/"searchaddpl" support the "sort" and
"window" parameters
* input
- ffmpeg: allow partial reads
* filter
...
...
doc/protocol.rst
View file @
b1b630a4
...
...
@@ -849,7 +849,7 @@ The music database
.. _command_findadd:
:command:`findadd {FILTER}`
:command:`findadd {FILTER}
[sort {TYPE}] [window {START:END}]
`
Search the database for songs matching
``FILTER`` (see :ref:`Filters <filter_syntax>`) and add them to
the queue. Parameters have the same meaning as for
...
...
@@ -961,14 +961,14 @@ The music database
.. _command_searchadd:
:command:`searchadd {FILTER}`
:command:`searchadd {FILTER}
[sort {TYPE}] [window {START:END}]
`
Search the database for songs matching
``FILTER`` (see :ref:`Filters <filter_syntax>`) and add them to
the queue.
Parameters have the same meaning as for :ref:`search <command_search>`.
:command:`searchaddpl {NAME} {FILTER}`
:command:`searchaddpl {NAME} {FILTER}
[sort {TYPE}] [window {START:END}]
`
Search the database for songs matching
``FILTER`` (see :ref:`Filters <filter_syntax>`) and add them to
the playlist named ``NAME``.
...
...
src/command/DatabaseCommands.cxx
View file @
b1b630a4
...
...
@@ -140,55 +140,37 @@ handle_search(Client &client, Request args, Response &r)
}
static
CommandResult
handle_match_add
(
Client
&
client
,
Request
args
,
Response
&
r
,
bool
fold_case
)
handle_match_add
(
Client
&
client
,
Request
args
,
bool
fold_case
)
{
SongFilter
filter
;
try
{
filter
.
Parse
(
args
,
fold_case
);
}
catch
(...)
{
r
.
Error
(
ACK_ERROR_ARG
,
GetFullMessage
(
std
::
current_exception
()).
c_str
());
return
CommandResult
::
ERROR
;
}
filter
.
Optimize
();
const
auto
selection
=
ParseDatabaseSelection
(
args
,
fold_case
,
filter
);
auto
&
partition
=
client
.
GetPartition
();
const
ScopeBulkEdit
bulk_edit
(
partition
);
const
DatabaseSelection
selection
(
""
,
true
,
&
filter
);
AddFromDatabase
(
partition
,
selection
);
return
CommandResult
::
OK
;
}
CommandResult
handle_findadd
(
Client
&
client
,
Request
args
,
Response
&
r
)
handle_findadd
(
Client
&
client
,
Request
args
,
Response
&
)
{
return
handle_match_add
(
client
,
args
,
r
,
false
);
return
handle_match_add
(
client
,
args
,
false
);
}
CommandResult
handle_searchadd
(
Client
&
client
,
Request
args
,
Response
&
r
)
handle_searchadd
(
Client
&
client
,
Request
args
,
Response
&
)
{
return
handle_match_add
(
client
,
args
,
r
,
true
);
return
handle_match_add
(
client
,
args
,
true
);
}
CommandResult
handle_searchaddpl
(
Client
&
client
,
Request
args
,
Response
&
r
)
handle_searchaddpl
(
Client
&
client
,
Request
args
,
Response
&
)
{
const
char
*
playlist
=
args
.
shift
();
SongFilter
filter
;
try
{
filter
.
Parse
(
args
,
true
);
}
catch
(...)
{
r
.
Error
(
ACK_ERROR_ARG
,
GetFullMessage
(
std
::
current_exception
()).
c_str
());
return
CommandResult
::
ERROR
;
}
filter
.
Optimize
();
const
auto
selection
=
ParseDatabaseSelection
(
args
,
true
,
filter
);
const
Database
&
db
=
client
.
GetDatabaseOrThrow
();
const
DatabaseSelection
selection
(
""
,
true
,
&
filter
);
search_add_to_playlist
(
db
,
client
.
GetStorage
(),
playlist
,
selection
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment