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
fa1fb47d
Commit
fa1fb47d
authored
Jun 23, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v0.18.x'
parents
b9eeb6e6
848ed147
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
1 deletion
+68
-1
NEWS
NEWS
+5
-0
SongFilter.cxx
src/SongFilter.cxx
+10
-0
SongFilter.hxx
src/SongFilter.hxx
+11
-0
Selection.cxx
src/db/Selection.cxx
+12
-0
Selection.hxx
src/db/Selection.hxx
+9
-0
ProxyDatabasePlugin.cxx
src/db/plugins/ProxyDatabasePlugin.cxx
+21
-1
No files found.
NEWS
View file @
fa1fb47d
...
...
@@ -43,6 +43,11 @@ ver 0.19 (not yet released)
* install systemd unit for socket activation
* Android port
ver 0.18.12 (not yet released)
* database
- proxy: fix build failure with libmpdclient 2.2
- proxy: fix add/search and other commands with libmpdclient < 2.9
ver 0.18.11 (2014/05/12)
* decoder
- opus: fix missing song length on high-latency files
...
...
src/SongFilter.cxx
View file @
fa1fb47d
...
...
@@ -214,6 +214,16 @@ SongFilter::Match(const LightSong &song) const
return
true
;
}
bool
SongFilter
::
HasOtherThanBase
()
const
{
for
(
const
auto
&
i
:
items
)
if
(
i
.
GetTag
()
!=
LOCATE_TAG_BASE_TYPE
)
return
true
;
return
false
;
}
std
::
string
SongFilter
::
GetBase
()
const
{
...
...
src/SongFilter.hxx
View file @
fa1fb47d
...
...
@@ -117,6 +117,11 @@ public:
return
items
;
}
gcc_pure
bool
IsEmpty
()
const
{
return
items
.
empty
();
}
/**
* Is there at least one item with "fold case" enabled?
*/
...
...
@@ -130,6 +135,12 @@ public:
}
/**
* Does this filter contain constraints other than "base"?
*/
gcc_pure
bool
HasOtherThanBase
()
const
;
/**
* Returns the "base" specification (if there is one) or an
* empty string.
*/
...
...
src/db/Selection.cxx
View file @
fa1fb47d
...
...
@@ -31,6 +31,18 @@ DatabaseSelection::DatabaseSelection(const char *_uri, bool _recursive,
}
bool
DatabaseSelection
::
IsEmpty
()
const
{
return
uri
.
empty
()
&&
(
filter
==
nullptr
||
filter
->
IsEmpty
());
}
bool
DatabaseSelection
::
HasOtherThanBase
()
const
{
return
filter
!=
nullptr
&&
filter
->
HasOtherThanBase
();
}
bool
DatabaseSelection
::
Match
(
const
LightSong
&
song
)
const
{
return
filter
==
nullptr
||
filter
->
Match
(
song
);
...
...
src/db/Selection.hxx
View file @
fa1fb47d
...
...
@@ -45,6 +45,15 @@ struct DatabaseSelection {
const
SongFilter
*
_filter
=
nullptr
);
gcc_pure
bool
IsEmpty
()
const
;
/**
* Does this selection contain constraints other than "base"?
*/
gcc_pure
bool
HasOtherThanBase
()
const
;
gcc_pure
bool
Match
(
const
LightSong
&
song
)
const
;
};
...
...
src/db/plugins/ProxyDatabasePlugin.cxx
View file @
fa1fb47d
...
...
@@ -695,6 +695,23 @@ SearchSongs(struct mpd_connection *connection,
return
result
&&
CheckError
(
connection
,
error
);
}
/**
* 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
)
{
#if LIBMPDCLIENT_CHECK_VERSION(2,9,0)
return
mpd_connection_cmp_server_version
(
connection
,
0
,
18
,
0
)
>=
0
;
#else
(
void
)
connection
;
return
false
;
#endif
}
bool
ProxyDatabase
::
Visit
(
const
DatabaseSelection
&
selection
,
VisitDirectory
visit_directory
,
...
...
@@ -706,7 +723,10 @@ ProxyDatabase::Visit(const DatabaseSelection &selection,
if
(
!
const_cast
<
ProxyDatabase
*>
(
this
)
->
EnsureConnected
(
error
))
return
nullptr
;
if
(
!
visit_directory
&&
!
visit_playlist
&&
selection
.
recursive
)
if
(
!
visit_directory
&&
!
visit_playlist
&&
selection
.
recursive
&&
(
ServerSupportsSearchBase
(
connection
)
?
!
selection
.
IsEmpty
()
:
selection
.
HasOtherThanBase
()))
/* this optimized code path can only be used under
certain conditions */
return
::
SearchSongs
(
connection
,
selection
,
visit_song
,
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