diff --git a/NEWS b/NEWS index 9d2c98dc7..f1f16c4da 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.21.4 (not yet released) +* database + - upnp: implement "list ... group" ver 0.21.3 (2018/11/16) * output 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> UpnpDatabase::CollectUniqueTags(const DatabaseSelection &selection, TagType tag, TagType group) const { - (void)group; // TODO: use group - - std::map> 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