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
2b7529e9
Commit
2b7529e9
authored
Oct 30, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/proxy: pass SongFilter to the remote MPD in VisitUniqueTags()
parent
1ed321f9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
2 deletions
+72
-2
ProxyDatabasePlugin.cxx
src/db/ProxyDatabasePlugin.cxx
+72
-2
No files found.
src/db/ProxyDatabasePlugin.cxx
View file @
2b7529e9
...
...
@@ -126,6 +126,76 @@ CheckError(struct mpd_connection *connection, Error &error)
return
false
;
}
static
bool
SendConstraints
(
mpd_connection
*
connection
,
const
SongFilter
::
Item
&
item
)
{
switch
(
item
.
GetTag
())
{
mpd_tag_type
tag
;
#if LIBMPDCLIENT_CHECK_VERSION(2,9,0)
case
LOCATE_TAG_BASE_TYPE
:
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
,
item
.
GetValue
().
c_str
());
#endif
case
LOCATE_TAG_FILE_TYPE
:
return
mpd_search_add_uri_constraint
(
connection
,
MPD_OPERATOR_DEFAULT
,
item
.
GetValue
().
c_str
());
case
LOCATE_TAG_ANY_TYPE
:
return
mpd_search_add_any_tag_constraint
(
connection
,
MPD_OPERATOR_DEFAULT
,
item
.
GetValue
().
c_str
());
default:
tag
=
Convert
(
TagType
(
item
.
GetTag
()));
if
(
tag
==
MPD_TAG_COUNT
)
return
true
;
return
mpd_search_add_tag_constraint
(
connection
,
MPD_OPERATOR_DEFAULT
,
tag
,
item
.
GetValue
().
c_str
());
}
}
static
bool
SendConstraints
(
mpd_connection
*
connection
,
const
SongFilter
&
filter
)
{
for
(
const
auto
&
i
:
filter
.
GetItems
())
if
(
!
SendConstraints
(
connection
,
i
))
return
false
;
return
true
;
}
static
bool
SendConstraints
(
mpd_connection
*
connection
,
const
DatabaseSelection
&
selection
)
{
#if LIBMPDCLIENT_CHECK_VERSION(2,9,0)
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_OPERATOR_DEFAULT
,
selection
.
uri
.
c_str
()))
return
false
;
}
#endif
if
(
selection
.
filter
!=
nullptr
&&
!
SendConstraints
(
connection
,
*
selection
.
filter
))
return
false
;
return
true
;
}
Database
*
ProxyDatabase
::
Create
(
const
config_param
&
param
,
Error
&
error
)
{
...
...
@@ -433,8 +503,8 @@ ProxyDatabase::VisitUniqueTags(const DatabaseSelection &selection,
if
(
!
mpd_search_db_tags
(
connection
,
tag_type2
))
return
CheckError
(
connection
,
error
);
// TODO: match
(
void
)
selection
;
if
(
!
SendConstraints
(
connection
,
selection
))
return
CheckError
(
connection
,
error
)
;
if
(
!
mpd_search_commit
(
connection
))
return
CheckError
(
connection
,
error
);
...
...
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