diff options
author | Max Kellermann <max@musicpd.org> | 2018-11-19 20:08:10 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-11-19 20:08:10 +0100 |
commit | 4b7078297d9579bf5bf804a94e4f09a5c31167d4 (patch) | |
tree | 523c82d1c1808fcbd6ffe48ef9a8492282d283d5 /src/db | |
parent | 841694ccf2acb75f75a812421ddb8e99a3f9d48b (diff) |
db/upnp: use the generic ::CollectUniqueTags() function
This function implements the "group" feature on top of the
Database::Visit() method.
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/plugins/upnp/UpnpDatabasePlugin.cxx | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx index 89c5c7a02..6db9da940 100644 --- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx +++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx @@ -27,6 +27,7 @@ #include "db/DatabasePlugin.hxx" #include "db/Selection.hxx" #include "db/VHelper.hxx" +#include "db/UniqueTags.hxx" #include "db/DatabaseError.hxx" #include "db/LightDirectory.hxx" #include "song/LightSong.hxx" @@ -627,27 +628,7 @@ std::map<std::string, std::set<std::string>> UpnpDatabase::CollectUniqueTags(const DatabaseSelection &selection, TagType tag, TagType group) const { - (void)group; // TODO: use group - - std::map<std::string, std::set<std::string>> result; - auto &values = result[std::string()]; - - for (auto& server : discovery->GetDirectories()) { - const auto dirbuf = SearchSongs(server, rootid, selection); - - for (const auto &dirent : dirbuf.objects) { - if (dirent.type != UPnPDirObject::Type::ITEM || - dirent.item_class != UPnPDirObject::ItemClass::MUSIC) - continue; - - const char *value = dirent.tag.GetValue(tag); - if (value != nullptr) { - values.emplace(value); - } - } - } - - return result; + return ::CollectUniqueTags(*this, selection, tag, group); } DatabaseStats |