DatabaseSelection: add "match" attribute

Let the database plugin do the match.
This commit is contained in:
Max Kellermann
2012-08-07 23:22:37 +02:00
parent 8d2725234e
commit 733d6a6b16
12 changed files with 57 additions and 97 deletions

View File

@@ -27,6 +27,7 @@ extern "C" {
#include "db_save.h"
#include "db_lock.h"
#include "conf.h"
#include "locate.h"
}
#include "directory.h"
@@ -247,7 +248,9 @@ SimpleDatabase::Visit(const DatabaseSelection &selection,
if (directory == NULL) {
struct song *song;
if (visit_song &&
(song = GetSong(selection.uri, NULL)) != NULL)
(song = GetSong(selection.uri, NULL)) != NULL &&
(selection.match == NULL ||
locate_list_song_match(song, selection.match)))
return visit_song(*song, error_r);
g_set_error(error_r, db_quark(), DB_NOT_FOUND,
@@ -260,7 +263,7 @@ SimpleDatabase::Visit(const DatabaseSelection &selection,
return false;
db_lock();
bool ret = directory->Walk(selection.recursive,
bool ret = directory->Walk(selection.recursive, selection.match,
visit_directory, visit_song, visit_playlist,
error_r);
db_unlock();