db/simple: pass DatabaseSelection to WalkMount()
This passes the new `sort` and `window` attributes to the mounted database.
This commit is contained in:
parent
a73176a1e9
commit
94694e0f33
@ -27,6 +27,7 @@
|
|||||||
#include "db/Uri.hxx"
|
#include "db/Uri.hxx"
|
||||||
#include "db/DatabaseLock.hxx"
|
#include "db/DatabaseLock.hxx"
|
||||||
#include "db/Interface.hxx"
|
#include "db/Interface.hxx"
|
||||||
|
#include "db/Selection.hxx"
|
||||||
#include "song/Filter.hxx"
|
#include "song/Filter.hxx"
|
||||||
#include "lib/icu/Collate.hxx"
|
#include "lib/icu/Collate.hxx"
|
||||||
#include "fs/Traits.hxx"
|
#include "fs/Traits.hxx"
|
||||||
@ -227,7 +228,7 @@ Directory::Walk(bool recursive, const SongFilter *filter,
|
|||||||
call will lock it again */
|
call will lock it again */
|
||||||
const ScopeDatabaseUnlock unlock;
|
const ScopeDatabaseUnlock unlock;
|
||||||
WalkMount(GetPath(), *mounted_database,
|
WalkMount(GetPath(), *mounted_database,
|
||||||
"", recursive, filter,
|
"", DatabaseSelection("", recursive, filter),
|
||||||
visit_directory, visit_song,
|
visit_directory, visit_song,
|
||||||
visit_playlist);
|
visit_playlist);
|
||||||
return;
|
return;
|
||||||
|
@ -66,7 +66,8 @@ PrefixVisitPlaylist(const char *base, const VisitPlaylist &visit_playlist,
|
|||||||
|
|
||||||
void
|
void
|
||||||
WalkMount(const char *base, const Database &db,
|
WalkMount(const char *base, const Database &db,
|
||||||
const char* uri, bool recursive, const SongFilter *filter,
|
const char *uri,
|
||||||
|
const DatabaseSelection &old_selection,
|
||||||
const VisitDirectory &visit_directory, const VisitSong &visit_song,
|
const VisitDirectory &visit_directory, const VisitSong &visit_song,
|
||||||
const VisitPlaylist &visit_playlist)
|
const VisitPlaylist &visit_playlist)
|
||||||
{
|
{
|
||||||
@ -87,16 +88,19 @@ WalkMount(const char *base, const Database &db,
|
|||||||
vp = std::bind(PrefixVisitPlaylist,
|
vp = std::bind(PrefixVisitPlaylist,
|
||||||
base, std::ref(visit_playlist), _1, _2);
|
base, std::ref(visit_playlist), _1, _2);
|
||||||
|
|
||||||
|
DatabaseSelection selection(old_selection);
|
||||||
|
selection.uri = uri;
|
||||||
|
|
||||||
SongFilter prefix_filter;
|
SongFilter prefix_filter;
|
||||||
|
|
||||||
if (base != nullptr && filter != nullptr) {
|
if (base != nullptr && selection.filter != nullptr) {
|
||||||
/* if the SongFilter contains a LOCATE_TAG_BASE_TYPE
|
/* if the SongFilter contains a LOCATE_TAG_BASE_TYPE
|
||||||
item, copy the SongFilter and drop the mount point
|
item, copy the SongFilter and drop the mount point
|
||||||
from the filter, because the mounted database
|
from the filter, because the mounted database
|
||||||
doesn't know its own location within MPD's VFS */
|
doesn't know its own location within MPD's VFS */
|
||||||
prefix_filter = filter->WithoutBasePrefix(base);
|
prefix_filter = selection.filter->WithoutBasePrefix(base);
|
||||||
filter = &prefix_filter;
|
selection.filter = &prefix_filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
db.Visit(DatabaseSelection(uri, recursive, filter), vd, vs, vp);
|
db.Visit(selection, vd, vs, vp);
|
||||||
}
|
}
|
||||||
|
@ -23,11 +23,12 @@
|
|||||||
#include "db/Visitor.hxx"
|
#include "db/Visitor.hxx"
|
||||||
|
|
||||||
class Database;
|
class Database;
|
||||||
class SongFilter;
|
struct DatabaseSelection;
|
||||||
|
|
||||||
void
|
void
|
||||||
WalkMount(const char *base, const Database &db,
|
WalkMount(const char *base, const Database &db,
|
||||||
const char* uri, bool recursive, const SongFilter *filter,
|
const char *uri,
|
||||||
|
const DatabaseSelection &old_selection,
|
||||||
const VisitDirectory &visit_directory, const VisitSong &visit_song,
|
const VisitDirectory &visit_directory, const VisitSong &visit_song,
|
||||||
const VisitPlaylist &visit_playlist);
|
const VisitPlaylist &visit_playlist);
|
||||||
|
|
||||||
|
@ -280,8 +280,8 @@ SimpleDatabase::Visit(const DatabaseSelection &selection,
|
|||||||
protect.unlock();
|
protect.unlock();
|
||||||
|
|
||||||
WalkMount(r.directory->GetPath(), *(r.directory->mounted_database),
|
WalkMount(r.directory->GetPath(), *(r.directory->mounted_database),
|
||||||
(r.uri == nullptr)?"":r.uri, selection.recursive, selection.filter,
|
(r.uri == nullptr)?"":r.uri, selection,
|
||||||
visit_directory, visit_song, visit_playlist);
|
visit_directory, visit_song, visit_playlist);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user