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
9cc960ac
Commit
9cc960ac
authored
6 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/proxy: require MPD 0.19
parent
18dd082f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
22 deletions
+6
-22
ProxyDatabasePlugin.cxx
src/db/plugins/ProxyDatabasePlugin.cxx
+6
-22
No files found.
src/db/plugins/ProxyDatabasePlugin.cxx
View file @
9cc960ac
...
...
@@ -336,10 +336,6 @@ SendConstraints(mpd_connection *connection, const ISongFilter &f)
MPD_OPERATOR_DEFAULT
,
u
->
GetValue
().
c_str
());
}
else
if
(
auto
b
=
dynamic_cast
<
const
BaseSongFilter
*>
(
&
f
))
{
if
(
mpd_connection_cmp_server_version
(
connection
,
0
,
18
,
0
)
<
0
)
/* requires MPD 0.18 */
return
true
;
return
mpd_search_add_base_constraint
(
connection
,
MPD_OPERATOR_DEFAULT
,
b
->
GetValue
());
...
...
@@ -361,13 +357,10 @@ static bool
SendConstraints
(
mpd_connection
*
connection
,
const
DatabaseSelection
&
selection
)
{
if
(
!
selection
.
uri
.
empty
()
&&
mpd_connection_cmp_server_version
(
connection
,
0
,
18
,
0
)
>=
0
)
{
/* requires MPD 0.18 */
if
(
!
mpd_search_add_base_constraint
(
connection
,
!
mpd_search_add_base_constraint
(
connection
,
MPD_OPERATOR_DEFAULT
,
selection
.
uri
.
c_str
()))
return
false
;
}
if
(
selection
.
filter
!=
nullptr
&&
!
SendConstraints
(
connection
,
*
selection
.
filter
))
...
...
@@ -457,6 +450,10 @@ ProxyDatabase::Connect()
try
{
CheckError
(
connection
);
if
(
mpd_connection_cmp_server_version
(
connection
,
0
,
19
,
0
)
<
0
)
throw
FormatRuntimeError
(
"Connect to MPD %s, but this plugin requires at least version 0.19"
,
mpd_connection_get_server_version
(
connection
));
if
(
!
password
.
empty
()
&&
!
mpd_run_password
(
connection
,
password
.
c_str
()))
ThrowError
(
connection
);
...
...
@@ -807,17 +804,6 @@ try {
throw
;
}
/**
* Check whether we can use the "base" constraint. Requires
* libmpdclient 2.9 and MPD 0.18.
*/
gcc_pure
static
bool
ServerSupportsSearchBase
(
const
struct
mpd_connection
*
connection
)
noexcept
{
return
mpd_connection_cmp_server_version
(
connection
,
0
,
18
,
0
)
>=
0
;
}
void
ProxyDatabase
::
Visit
(
const
DatabaseSelection
&
selection
,
VisitDirectory
visit_directory
,
...
...
@@ -828,9 +814,7 @@ ProxyDatabase::Visit(const DatabaseSelection &selection,
const_cast
<
ProxyDatabase
*>
(
this
)
->
EnsureConnected
();
if
(
!
visit_directory
&&
!
visit_playlist
&&
selection
.
recursive
&&
(
ServerSupportsSearchBase
(
connection
)
?
!
selection
.
IsEmpty
()
:
selection
.
HasOtherThanBase
()))
{
!
selection
.
IsEmpty
())
{
/* this optimized code path can only be used under
certain conditions */
::
SearchSongs
(
connection
,
selection
,
visit_song
);
...
...
This diff is collapsed.
Click to expand it.
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