diff options
author | Max Kellermann <max@musicpd.org> | 2018-09-02 12:35:10 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-09-02 17:37:02 +0200 |
commit | c7c32a3ce92f4fa483a4a1b41aa39cdaa0afcf45 (patch) | |
tree | 500f6fefdadcb1953fb958213da434e865659ca7 /src/db/plugins/upnp/UpnpDatabasePlugin.cxx | |
parent | 53170ca2f24112df6f85b7e8313adf8ce839c627 (diff) |
db/Print: move sort/window emulation code to class DatabaseVisitorHelper
That way, each plugin can decide to implement it better.
Diffstat (limited to 'src/db/plugins/upnp/UpnpDatabasePlugin.cxx')
-rw-r--r-- | src/db/plugins/upnp/UpnpDatabasePlugin.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx index 1f7732da7..9d6a64f04 100644 --- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx +++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx @@ -27,6 +27,7 @@ #include "db/Interface.hxx" #include "db/DatabasePlugin.hxx" #include "db/Selection.hxx" +#include "db/VHelper.hxx" #include "db/DatabaseError.hxx" #include "db/LightDirectory.hxx" #include "song/LightSong.hxx" @@ -576,6 +577,15 @@ UpnpDatabase::VisitServer(const ContentDirectoryService &server, } } +gcc_const +static DatabaseSelection +CheckSelection(DatabaseSelection selection) noexcept +{ + selection.uri.clear(); + selection.filter = nullptr; + return selection; +} + // Deal with the possibly multiple servers, call VisitServer if needed. void UpnpDatabase::Visit(const DatabaseSelection &selection, @@ -583,6 +593,8 @@ UpnpDatabase::Visit(const DatabaseSelection &selection, VisitSong visit_song, VisitPlaylist visit_playlist) const { + DatabaseVisitorHelper helper(CheckSelection(selection), visit_song); + auto vpath = SplitString(selection.uri.c_str(), '/'); if (vpath.empty()) { for (const auto &server : discovery->GetDirectories()) { @@ -598,6 +610,7 @@ UpnpDatabase::Visit(const DatabaseSelection &selection, visit_playlist); } + helper.Commit(); return; } @@ -608,6 +621,7 @@ UpnpDatabase::Visit(const DatabaseSelection &selection, auto server = discovery->GetServer(servername.c_str()); VisitServer(server, std::move(vpath), selection, visit_directory, visit_song, visit_playlist); + helper.Commit(); } void |