aboutsummaryrefslogtreecommitdiffstats
path: root/src/db/UpnpDatabasePlugin.cxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/db/UpnpDatabasePlugin.cxx39
1 files changed, 2 insertions, 37 deletions
diff --git a/src/db/UpnpDatabasePlugin.cxx b/src/db/UpnpDatabasePlugin.cxx
index da8aba22c..257797d1a 100644
--- a/src/db/UpnpDatabasePlugin.cxx
+++ b/src/db/UpnpDatabasePlugin.cxx
@@ -210,21 +210,7 @@ upnpItemToSong(const UPnPDirObject &dirent, const char *uri)
uri = dirent.url.c_str();
Song *s = Song::NewFile(uri, nullptr);
-
- TagBuilder tag;
-
- if (dirent.duration > 0)
- tag.SetTime(dirent.duration);
-
- tag.AddItem(TAG_TITLE, dirent.m_title.c_str());
-
- for (auto i = upnp_tags; i->name != nullptr; ++i) {
- const char *value = dirent.getprop(i->name);
- if (value != nullptr)
- tag.AddItem(i->type, value);
- }
-
- s->tag = tag.CommitNew();
+ s->tag = new Tag(dirent.tag);
return s;
}
@@ -268,27 +254,6 @@ UpnpDatabase::GetSong(const char *uri, Error &error) const
}
/**
- * Retrieve the value for an MPD tag from an object entry.
- */
-gcc_pure
-static const char *
-getTagValue(const UPnPDirObject &dirent, TagType tag)
-{
- if (tag == TAG_TITLE) {
- if (!dirent.m_title.empty())
- return dirent.m_title.c_str();
-
- return nullptr;
- }
-
- const char *name = tag_table_lookup(upnp_tags, tag);
- if (name == nullptr)
- return nullptr;
-
- return dirent.getprop(name);
-}
-
-/**
* Double-quote a string, adding internal backslash escaping.
*/
static void
@@ -801,7 +766,7 @@ UpnpDatabase::VisitUniqueTags(const DatabaseSelection &selection,
dirent.item_class != UPnPDirObject::ItemClass::MUSIC)
continue;
- const char *value = getTagValue(dirent, tag);
+ const char *value = dirent.tag.GetValue(tag);
if (value != nullptr) {
#if defined(__clang__) || GCC_CHECK_VERSION(4,8)
values.emplace(value);