diff options
author | Max Kellermann <max@duempel.org> | 2012-08-07 23:22:37 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-08-08 00:55:02 +0200 |
commit | 733d6a6b16686c852b6d0fc0e4e9197add501a2f (patch) | |
tree | c089ab2961a5b98558f7587df3c5ef995628e8b3 /src/Directory.cxx | |
parent | 8d2725234e6271434d87ecaac23ef882850e649a (diff) | |
download | mpd-733d6a6b16686c852b6d0fc0e4e9197add501a2f.tar.gz mpd-733d6a6b16686c852b6d0fc0e4e9197add501a2f.tar.xz mpd-733d6a6b16686c852b6d0fc0e4e9197add501a2f.zip |
DatabaseSelection: add "match" attribute
Let the database plugin do the match.
Diffstat (limited to 'src/Directory.cxx')
-rw-r--r-- | src/Directory.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Directory.cxx b/src/Directory.cxx index b10a0224f..326fa24e9 100644 --- a/src/Directory.cxx +++ b/src/Directory.cxx @@ -28,6 +28,7 @@ extern "C" { #include "util/list_sort.h" #include "db_visitor.h" #include "db_lock.h" +#include "locate.h" } #include <glib.h> @@ -281,7 +282,7 @@ directory_sort(struct directory *directory) } bool -directory::Walk(bool recursive, +directory::Walk(bool recursive, const locate_item_list *match, VisitDirectory visit_directory, VisitSong visit_song, VisitPlaylist visit_playlist, GError **error_r) const @@ -291,7 +292,9 @@ directory::Walk(bool recursive, if (visit_song) { struct song *song; directory_for_each_song(song, this) - if (!visit_song(*song, error_r)) + if ((match == NULL || + locate_list_song_match(song, match)) && + !visit_song(*song, error_r)) return false; } @@ -309,8 +312,9 @@ directory::Walk(bool recursive, return false; if (recursive && - !child->Walk(recursive, visit_directory, visit_song, - visit_playlist, error_r)) + !child->Walk(recursive, match, + visit_directory, visit_song, visit_playlist, + error_r)) return false; } |