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
0701333e
Commit
0701333e
authored
Sep 02, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/proxy: forward filter as expression to server
This adds support for the full set of MPD 0.21 filter types.
parent
a8e70f09
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
4 deletions
+23
-4
ProxyDatabasePlugin.cxx
src/db/plugins/ProxyDatabasePlugin.cxx
+23
-4
No files found.
src/db/plugins/ProxyDatabasePlugin.cxx
View file @
0701333e
...
...
@@ -347,6 +347,14 @@ SendConstraints(mpd_connection *connection, const ISongFilter &f)
static
bool
SendConstraints
(
mpd_connection
*
connection
,
const
SongFilter
&
filter
)
{
#if LIBMPDCLIENT_CHECK_VERSION(2, 15, 0)
if
(
mpd_connection_cmp_server_version
(
connection
,
0
,
21
,
0
)
>=
0
)
/* with MPD 0.21 (and libmpdclient 2.15), we can pass
arbitrary filters as expression */
return
mpd_search_add_expression
(
connection
,
filter
.
ToExpression
().
c_str
());
#endif
for
(
const
auto
&
i
:
filter
.
GetItems
())
if
(
!
SendConstraints
(
connection
,
*
i
))
return
false
;
...
...
@@ -870,8 +878,18 @@ IsFilterSupported(const ISongFilter &f) noexcept
gcc_pure
static
bool
IsFilterFullySupported
(
const
SongFilter
&
filter
)
noexcept
IsFilterFullySupported
(
const
SongFilter
&
filter
,
const
struct
mpd_connection
*
connection
)
noexcept
{
#if LIBMPDCLIENT_CHECK_VERSION(2, 15, 0)
if
(
mpd_connection_cmp_server_version
(
connection
,
0
,
21
,
0
)
>=
0
)
/* with MPD 0.21 (and libmpdclient 2.15), we can pass
arbitrary filters as expression */
return
true
;
#else
(
void
)
connection
;
#endif
for
(
const
auto
&
i
:
filter
.
GetItems
())
if
(
!
IsFilterSupported
(
*
i
))
return
false
;
...
...
@@ -881,10 +899,11 @@ IsFilterFullySupported(const SongFilter &filter) noexcept
gcc_pure
static
bool
IsFilterFullySupported
(
const
SongFilter
*
filter
)
noexcept
IsFilterFullySupported
(
const
SongFilter
*
filter
,
const
struct
mpd_connection
*
connection
)
noexcept
{
return
filter
==
nullptr
||
IsFilterFullySupported
(
*
filter
);
IsFilterFullySupported
(
*
filter
,
connection
);
}
#endif
...
...
@@ -933,7 +952,7 @@ CheckSelection(DatabaseSelection selection,
#if LIBMPDCLIENT_CHECK_VERSION(2, 10, 0)
if
(
selection
.
window
!=
RangeArg
::
All
()
&&
IsFilterFullySupported
(
selection
.
filter
))
IsFilterFullySupported
(
selection
.
filter
,
connection
))
/* we can forward the "window" parameter to the other
MPD */
selection
.
window
=
RangeArg
::
All
();
...
...
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