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
205448c1
Commit
205448c1
authored
Oct 29, 2013
by
Jean-Francois Dockes
Committed by
Max Kellermann
Oct 29, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/proxy: enable song matching
parent
2d11c6ab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
9 deletions
+23
-9
ProxyDatabasePlugin.cxx
src/db/ProxyDatabasePlugin.cxx
+23
-9
No files found.
src/db/ProxyDatabasePlugin.cxx
View file @
205448c1
...
...
@@ -25,6 +25,7 @@
#include "PlaylistVector.hxx"
#include "Directory.hxx"
#include "Song.hxx"
#include "SongFilter.hxx"
#include "Compiler.h"
#include "ConfigData.hxx"
#include "tag/TagBuilder.hxx"
...
...
@@ -220,12 +221,14 @@ ProxyDatabase::ReturnSong(Song *song) const
static
bool
Visit
(
struct
mpd_connection
*
connection
,
const
char
*
uri
,
bool
recursive
,
VisitDirectory
visit_directory
,
VisitSong
visit_song
,
bool
recursive
,
const
SongFilter
*
filter
,
VisitDirectory
visit_directory
,
VisitSong
visit_song
,
VisitPlaylist
visit_playlist
,
Error
&
error
);
static
bool
Visit
(
struct
mpd_connection
*
connection
,
bool
recursive
,
const
struct
mpd_directory
*
directory
,
bool
recursive
,
const
SongFilter
*
filter
,
const
struct
mpd_directory
*
directory
,
VisitDirectory
visit_directory
,
VisitSong
visit_song
,
VisitPlaylist
visit_playlist
,
Error
&
error
)
{
...
...
@@ -240,7 +243,7 @@ Visit(struct mpd_connection *connection,
}
if
(
recursive
&&
!
Visit
(
connection
,
path
,
recursive
,
!
Visit
(
connection
,
path
,
recursive
,
filter
,
visit_directory
,
visit_song
,
visit_playlist
,
error
))
return
false
;
...
...
@@ -281,15 +284,23 @@ Convert(const struct mpd_song *song)
return
s
;
}
gcc_pure
static
bool
Match
(
const
SongFilter
*
filter
,
const
Song
&
song
)
{
return
filter
==
nullptr
||
filter
->
Match
(
song
);
}
static
bool
Visit
(
const
struct
mpd_song
*
song
,
Visit
(
const
SongFilter
*
filter
,
const
struct
mpd_song
*
song
,
VisitSong
visit_song
,
Error
&
error
)
{
if
(
!
visit_song
)
return
true
;
Song
*
s
=
Convert
(
song
);
bool
success
=
visit_song
(
*
s
,
error
);
bool
success
=
!
Match
(
filter
,
*
s
)
||
visit_song
(
*
s
,
error
);
s
->
Free
();
return
success
;
...
...
@@ -348,7 +359,8 @@ ReceiveEntities(struct mpd_connection *connection)
static
bool
Visit
(
struct
mpd_connection
*
connection
,
const
char
*
uri
,
bool
recursive
,
VisitDirectory
visit_directory
,
VisitSong
visit_song
,
bool
recursive
,
const
SongFilter
*
filter
,
VisitDirectory
visit_directory
,
VisitSong
visit_song
,
VisitPlaylist
visit_playlist
,
Error
&
error
)
{
if
(
!
mpd_send_list_meta
(
connection
,
uri
))
...
...
@@ -364,7 +376,7 @@ Visit(struct mpd_connection *connection, const char *uri,
break
;
case
MPD_ENTITY_TYPE_DIRECTORY
:
if
(
!
Visit
(
connection
,
recursive
,
if
(
!
Visit
(
connection
,
recursive
,
filter
,
mpd_entity_get_directory
(
entity
),
visit_directory
,
visit_song
,
visit_playlist
,
error
))
...
...
@@ -372,7 +384,8 @@ Visit(struct mpd_connection *connection, const char *uri,
break
;
case
MPD_ENTITY_TYPE_SONG
:
if
(
!
Visit
(
mpd_entity_get_song
(
entity
),
visit_song
,
if
(
!
Visit
(
filter
,
mpd_entity_get_song
(
entity
),
visit_song
,
error
))
return
false
;
break
;
...
...
@@ -398,7 +411,8 @@ ProxyDatabase::Visit(const DatabaseSelection &selection,
// TODO: match
// TODO: auto-reconnect
return
::
Visit
(
connection
,
selection
.
uri
.
c_str
(),
selection
.
recursive
,
return
::
Visit
(
connection
,
selection
.
uri
.
c_str
(),
selection
.
recursive
,
selection
.
filter
,
visit_directory
,
visit_song
,
visit_playlist
,
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