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