Commit c71242d7 authored by Max Kellermann's avatar Max Kellermann

playlist/asx: use tag_table to convert element name to TagType

parent c45f1138
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "../PlaylistPlugin.hxx" #include "../PlaylistPlugin.hxx"
#include "../MemorySongEnumerator.hxx" #include "../MemorySongEnumerator.hxx"
#include "tag/Builder.hxx" #include "tag/Builder.hxx"
#include "tag/Table.hxx"
#include "util/ASCII.hxx" #include "util/ASCII.hxx"
#include "util/StringView.hxx" #include "util/StringView.hxx"
#include "lib/expat/ExpatParser.hxx" #include "lib/expat/ExpatParser.hxx"
...@@ -62,6 +63,14 @@ struct AsxParser { ...@@ -62,6 +63,14 @@ struct AsxParser {
}; };
static constexpr struct tag_table asx_tag_elements[] = {
/* is that correct? or should it be COMPOSER or PERFORMER? */
{ "author", TAG_ARTIST },
{ "title", TAG_TITLE },
{ nullptr, TAG_NUM_OF_ITEM_TYPES }
};
static void XMLCALL static void XMLCALL
asx_start_element(void *user_data, const XML_Char *element_name, asx_start_element(void *user_data, const XML_Char *element_name,
const XML_Char **atts) const XML_Char **atts)
...@@ -84,12 +93,9 @@ asx_start_element(void *user_data, const XML_Char *element_name, ...@@ -84,12 +93,9 @@ asx_start_element(void *user_data, const XML_Char *element_name,
ExpatParser::GetAttributeCase(atts, "href"); ExpatParser::GetAttributeCase(atts, "href");
if (href != nullptr) if (href != nullptr)
parser->location = href; parser->location = href;
} else if (StringEqualsCaseASCII(element_name, "author")) } else
/* is that correct? or should it be COMPOSER parser->tag_type = tag_table_lookup_i(asx_tag_elements,
or PERFORMER? */ element_name);
parser->tag_type = TAG_ARTIST;
else if (StringEqualsCaseASCII(element_name, "title"))
parser->tag_type = TAG_TITLE;
break; break;
} }
......
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