Commit 65ebfb16 authored by Max Kellermann's avatar Max Kellermann

db/upnp/Directory: parse item_class in StartElement

Don't add to the std::map.
parent 44a65fc5
...@@ -32,7 +32,6 @@ static const char *const upnptags[] = { ...@@ -32,7 +32,6 @@ static const char *const upnptags[] = {
"upnp:album", "upnp:album",
"upnp:genre", "upnp:genre",
"upnp:originalTrackNumber", "upnp:originalTrackNumber",
"upnp:class",
nullptr, nullptr,
}; };
...@@ -105,6 +104,12 @@ protected: ...@@ -105,6 +104,12 @@ protected:
const char *pid = GetAttribute(attrs, "parentID"); const char *pid = GetAttribute(attrs, "parentID");
if (pid != nullptr) if (pid != nullptr)
m_tobj.m_pid = pid; 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; break;
...@@ -126,19 +131,10 @@ protected: ...@@ -126,19 +131,10 @@ protected:
bool checkobjok() { bool checkobjok() {
if (m_tobj.m_id.empty() || m_tobj.m_pid.empty() || 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; 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; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment