Merge tag 'v0.21.21'
release v0.21.21
This commit is contained in:
@@ -399,7 +399,7 @@ MainConfigured(const struct options &options, const ConfigData &raw_config)
|
||||
#endif
|
||||
|
||||
const unsigned max_clients =
|
||||
raw_config.GetPositive(ConfigOption::MAX_CONN, 10);
|
||||
raw_config.GetPositive(ConfigOption::MAX_CONN, 100);
|
||||
instance.client_list = std::make_unique<ClientList>(max_clients);
|
||||
|
||||
const auto *input_cache_config = raw_config.GetBlock(ConfigBlockOption::INPUT_CACHE);
|
||||
|
@@ -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"
|
||||
@@ -40,6 +41,7 @@ struct AsxParser {
|
||||
*/
|
||||
enum {
|
||||
ROOT, ENTRY,
|
||||
TAG,
|
||||
} state{ROOT};
|
||||
|
||||
/**
|
||||
@@ -56,8 +58,15 @@ struct AsxParser {
|
||||
|
||||
TagBuilder tag_builder;
|
||||
|
||||
AsxParser() = default;
|
||||
std::string value;
|
||||
};
|
||||
|
||||
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
|
||||
@@ -65,13 +74,13 @@ asx_start_element(void *user_data, const XML_Char *element_name,
|
||||
const XML_Char **atts)
|
||||
{
|
||||
auto *parser = (AsxParser *)user_data;
|
||||
parser->value.clear();
|
||||
|
||||
switch (parser->state) {
|
||||
case AsxParser::ROOT:
|
||||
if (StringEqualsCaseASCII(element_name, "entry")) {
|
||||
parser->state = AsxParser::ENTRY;
|
||||
parser->location.clear();
|
||||
parser->tag_type = TAG_NUM_OF_ITEM_TYPES;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -82,14 +91,17 @@ 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);
|
||||
if (parser->tag_type != TAG_NUM_OF_ITEM_TYPES)
|
||||
parser->state = AsxParser::TAG;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case AsxParser::TAG:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,11 +121,20 @@ asx_end_element(void *user_data, const XML_Char *element_name)
|
||||
parser->tag_builder.Commit());
|
||||
|
||||
parser->state = AsxParser::ROOT;
|
||||
} else
|
||||
parser->tag_type = TAG_NUM_OF_ITEM_TYPES;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case AsxParser::TAG:
|
||||
if (!parser->value.empty())
|
||||
parser->tag_builder.AddItem(parser->tag_type,
|
||||
StringView(parser->value.data(),
|
||||
parser->value.length()));
|
||||
parser->state = AsxParser::ENTRY;
|
||||
break;
|
||||
}
|
||||
|
||||
parser->value.clear();
|
||||
}
|
||||
|
||||
static void XMLCALL
|
||||
@@ -123,13 +144,11 @@ asx_char_data(void *user_data, const XML_Char *s, int len)
|
||||
|
||||
switch (parser->state) {
|
||||
case AsxParser::ROOT:
|
||||
case AsxParser::ENTRY:
|
||||
break;
|
||||
|
||||
case AsxParser::ENTRY:
|
||||
if (parser->tag_type != TAG_NUM_OF_ITEM_TYPES)
|
||||
parser->tag_builder.AddItem(parser->tag_type,
|
||||
StringView(s, len));
|
||||
|
||||
case AsxParser::TAG:
|
||||
parser->value.append(s, len);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user