From 65ebfb16c90f7c0921983009775b1a2414371d94 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 11 Jan 2014 01:40:21 +0100 Subject: db/upnp/Directory: parse item_class in StartElement Don't add to the std::map. --- src/db/upnp/Directory.cxx | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/db/upnp/Directory.cxx b/src/db/upnp/Directory.cxx index ecb11ab45..a42719e4d 100644 --- a/src/db/upnp/Directory.cxx +++ b/src/db/upnp/Directory.cxx @@ -32,7 +32,6 @@ static const char *const upnptags[] = { "upnp:album", "upnp:genre", "upnp:originalTrackNumber", - "upnp:class", nullptr, }; @@ -105,6 +104,12 @@ protected: const char *pid = GetAttribute(attrs, "parentID"); if (pid != nullptr) m_tobj.m_pid = pid; + + const char *item_class_name = + GetAttribute(attrs, "upnp:class"); + if (item_class_name != nullptr) + m_tobj.item_class = + ParseItemClass(item_class_name); } break; @@ -126,19 +131,10 @@ protected: bool checkobjok() { if (m_tobj.m_id.empty() || m_tobj.m_pid.empty() || - m_tobj.m_title.empty()) + m_tobj.m_title.empty() || + m_tobj.item_class == UPnPDirObject::ItemClass::UNKNOWN) return false; - if (m_tobj.type == UPnPDirObject::Type::ITEM) { - const char *item_class_name = - m_tobj.m_props["upnp:class"].c_str(); - auto item_class = ParseItemClass(item_class_name); - if (item_class == UPnPDirObject::ItemClass::UNKNOWN) - return false; - - m_tobj.item_class = item_class; - } - return true; } -- cgit v1.2.3