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
de4fd4c0
Commit
de4fd4c0
authored
Mar 25, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command/database: move code to ParseDatabaseSelection()
parent
95d8b308
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
DatabaseCommands.cxx
src/command/DatabaseCommands.cxx
+17
-6
No files found.
src/command/DatabaseCommands.cxx
View file @
de4fd4c0
...
...
@@ -70,8 +70,13 @@ ParseSortTag(const char *s)
return
tag
;
}
static
CommandResult
handle_match
(
Client
&
client
,
Request
args
,
Response
&
r
,
bool
fold_case
)
/**
* Convert all remaining arguments to a #DatabaseSelection.
*
* @param filter a buffer to be used for DatabaseSelection::filter
*/
static
DatabaseSelection
ParseDatabaseSelection
(
Request
args
,
bool
fold_case
,
SongFilter
&
filter
)
{
RangeArg
window
=
RangeArg
::
All
();
if
(
args
.
size
>=
2
&&
StringIsEqual
(
args
[
args
.
size
-
2
],
"window"
))
{
...
...
@@ -96,13 +101,11 @@ handle_match(Client &client, Request args, Response &r, bool fold_case)
args
.
pop_back
();
}
SongFilter
filter
;
try
{
filter
.
Parse
(
args
,
fold_case
);
}
catch
(...)
{
r
.
Error
(
ACK_ERROR_ARG
,
GetFullMessage
(
std
::
current_exception
()).
c_str
());
return
CommandResult
::
ERROR
;
throw
ProtocolError
(
ACK_ERROR_ARG
,
GetFullMessage
(
std
::
current_exception
()).
c_str
());
}
filter
.
Optimize
();
...
...
@@ -110,6 +113,14 @@ handle_match(Client &client, Request args, Response &r, bool fold_case)
selection
.
window
=
window
;
selection
.
sort
=
sort
;
selection
.
descending
=
descending
;
return
selection
;
}
static
CommandResult
handle_match
(
Client
&
client
,
Request
args
,
Response
&
r
,
bool
fold_case
)
{
SongFilter
filter
;
const
auto
selection
=
ParseDatabaseSelection
(
args
,
fold_case
,
filter
);
db_selection_print
(
r
,
client
.
GetPartition
(),
selection
,
true
,
false
);
...
...
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