db/proxy: require MPD 0.19
This commit is contained in:
parent
18dd082f1e
commit
9cc960ac5e
@ -336,10 +336,6 @@ SendConstraints(mpd_connection *connection, const ISongFilter &f)
|
|||||||
MPD_OPERATOR_DEFAULT,
|
MPD_OPERATOR_DEFAULT,
|
||||||
u->GetValue().c_str());
|
u->GetValue().c_str());
|
||||||
} else if (auto b = dynamic_cast<const BaseSongFilter *>(&f)) {
|
} 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,
|
return mpd_search_add_base_constraint(connection,
|
||||||
MPD_OPERATOR_DEFAULT,
|
MPD_OPERATOR_DEFAULT,
|
||||||
b->GetValue());
|
b->GetValue());
|
||||||
@ -361,13 +357,10 @@ static bool
|
|||||||
SendConstraints(mpd_connection *connection, const DatabaseSelection &selection)
|
SendConstraints(mpd_connection *connection, const DatabaseSelection &selection)
|
||||||
{
|
{
|
||||||
if (!selection.uri.empty() &&
|
if (!selection.uri.empty() &&
|
||||||
mpd_connection_cmp_server_version(connection, 0, 18, 0) >= 0) {
|
!mpd_search_add_base_constraint(connection,
|
||||||
/* requires MPD 0.18 */
|
MPD_OPERATOR_DEFAULT,
|
||||||
if (!mpd_search_add_base_constraint(connection,
|
selection.uri.c_str()))
|
||||||
MPD_OPERATOR_DEFAULT,
|
return false;
|
||||||
selection.uri.c_str()))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selection.filter != nullptr &&
|
if (selection.filter != nullptr &&
|
||||||
!SendConstraints(connection, *selection.filter))
|
!SendConstraints(connection, *selection.filter))
|
||||||
@ -457,6 +450,10 @@ ProxyDatabase::Connect()
|
|||||||
try {
|
try {
|
||||||
CheckError(connection);
|
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() &&
|
if (!password.empty() &&
|
||||||
!mpd_run_password(connection, password.c_str()))
|
!mpd_run_password(connection, password.c_str()))
|
||||||
ThrowError(connection);
|
ThrowError(connection);
|
||||||
@ -807,17 +804,6 @@ try {
|
|||||||
throw;
|
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
|
void
|
||||||
ProxyDatabase::Visit(const DatabaseSelection &selection,
|
ProxyDatabase::Visit(const DatabaseSelection &selection,
|
||||||
VisitDirectory visit_directory,
|
VisitDirectory visit_directory,
|
||||||
@ -828,9 +814,7 @@ ProxyDatabase::Visit(const DatabaseSelection &selection,
|
|||||||
const_cast<ProxyDatabase *>(this)->EnsureConnected();
|
const_cast<ProxyDatabase *>(this)->EnsureConnected();
|
||||||
|
|
||||||
if (!visit_directory && !visit_playlist && selection.recursive &&
|
if (!visit_directory && !visit_playlist && selection.recursive &&
|
||||||
(ServerSupportsSearchBase(connection)
|
!selection.IsEmpty()) {
|
||||||
? !selection.IsEmpty()
|
|
||||||
: selection.HasOtherThanBase())) {
|
|
||||||
/* this optimized code path can only be used under
|
/* this optimized code path can only be used under
|
||||||
certain conditions */
|
certain conditions */
|
||||||
::SearchSongs(connection, selection, visit_song);
|
::SearchSongs(connection, selection, visit_song);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user