Commit 0da63447 authored by Max Kellermann's avatar Max Kellermann

Merge tag 'v0.21.21'

release v0.21.21
parents cade4e71 c560ec8e
...@@ -35,17 +35,18 @@ ver 0.22 (not yet released) ...@@ -35,17 +35,18 @@ ver 0.22 (not yet released)
* switch to C++17 * switch to C++17
- GCC 7 or clang 4 (or newer) recommended - GCC 7 or clang 4 (or newer) recommended
ver 0.21.21 (not yet released) ver 0.21.21 (2020/03/19)
* configuration * configuration
- fix bug in "metadata_to_use" setting - fix bug in "metadata_to_use" setting
* playlist * playlist
- xspf: fix corrupt tags in the presence of XML entities - asx, xspf: fix corrupt tags in the presence of XML entities
* archive * archive
- iso9660: skip empty file names to work around libcdio bug - iso9660: skip empty file names to work around libcdio bug
* decoder * decoder
- gme: ignore empty tags - gme: ignore empty tags
* output * output
- solaris: port to NetBSD - solaris: port to NetBSD
* raise default "max_connections" value to 100
ver 0.21.20 (2020/02/16) ver 0.21.20 (2020/02/16)
* decoder * decoder
......
...@@ -692,7 +692,7 @@ These settings are various limitations to prevent :program:`MPD` from using too ...@@ -692,7 +692,7 @@ These settings are various limitations to prevent :program:`MPD` from using too
* - **connection_timeout SECONDS** * - **connection_timeout SECONDS**
- If a client does not send any new data in this time period, the connection is closed. Clients waiting in "idle" mode are excluded from this. Default is 60. - If a client does not send any new data in this time period, the connection is closed. Clients waiting in "idle" mode are excluded from this. Default is 60.
* - **max_connections NUMBER** * - **max_connections NUMBER**
- This specifies the maximum number of clients that can be connected to :program:`MPD` at the same time. Default is 5. - This specifies the maximum number of clients that can be connected to :program:`MPD` at the same time. Default is 100.
* - **max_playlist_length NUMBER** * - **max_playlist_length NUMBER**
- The maximum number of songs that can be in the playlist. Default is 16384. - The maximum number of songs that can be in the playlist. Default is 16384.
* - **max_command_list_size KBYTES** * - **max_command_list_size KBYTES**
......
...@@ -399,7 +399,7 @@ MainConfigured(const struct options &options, const ConfigData &raw_config) ...@@ -399,7 +399,7 @@ MainConfigured(const struct options &options, const ConfigData &raw_config)
#endif #endif
const unsigned max_clients = 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); instance.client_list = std::make_unique<ClientList>(max_clients);
const auto *input_cache_config = raw_config.GetBlock(ConfigBlockOption::INPUT_CACHE); const auto *input_cache_config = raw_config.GetBlock(ConfigBlockOption::INPUT_CACHE);
......
...@@ -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"
...@@ -40,6 +41,7 @@ struct AsxParser { ...@@ -40,6 +41,7 @@ struct AsxParser {
*/ */
enum { enum {
ROOT, ENTRY, ROOT, ENTRY,
TAG,
} state{ROOT}; } state{ROOT};
/** /**
...@@ -56,8 +58,15 @@ struct AsxParser { ...@@ -56,8 +58,15 @@ struct AsxParser {
TagBuilder tag_builder; 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 static void XMLCALL
...@@ -65,13 +74,13 @@ asx_start_element(void *user_data, const XML_Char *element_name, ...@@ -65,13 +74,13 @@ asx_start_element(void *user_data, const XML_Char *element_name,
const XML_Char **atts) const XML_Char **atts)
{ {
auto *parser = (AsxParser *)user_data; auto *parser = (AsxParser *)user_data;
parser->value.clear();
switch (parser->state) { switch (parser->state) {
case AsxParser::ROOT: case AsxParser::ROOT:
if (StringEqualsCaseASCII(element_name, "entry")) { if (StringEqualsCaseASCII(element_name, "entry")) {
parser->state = AsxParser::ENTRY; parser->state = AsxParser::ENTRY;
parser->location.clear(); parser->location.clear();
parser->tag_type = TAG_NUM_OF_ITEM_TYPES;
} }
break; break;
...@@ -82,14 +91,17 @@ asx_start_element(void *user_data, const XML_Char *element_name, ...@@ -82,14 +91,17 @@ 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; if (parser->tag_type != TAG_NUM_OF_ITEM_TYPES)
else if (StringEqualsCaseASCII(element_name, "title")) parser->state = AsxParser::TAG;
parser->tag_type = TAG_TITLE; }
break; break;
case AsxParser::TAG:
break;
} }
} }
...@@ -109,11 +121,20 @@ asx_end_element(void *user_data, const XML_Char *element_name) ...@@ -109,11 +121,20 @@ asx_end_element(void *user_data, const XML_Char *element_name)
parser->tag_builder.Commit()); parser->tag_builder.Commit());
parser->state = AsxParser::ROOT; parser->state = AsxParser::ROOT;
} else }
parser->tag_type = TAG_NUM_OF_ITEM_TYPES;
break; 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 static void XMLCALL
...@@ -123,13 +144,11 @@ asx_char_data(void *user_data, const XML_Char *s, int len) ...@@ -123,13 +144,11 @@ asx_char_data(void *user_data, const XML_Char *s, int len)
switch (parser->state) { switch (parser->state) {
case AsxParser::ROOT: case AsxParser::ROOT:
break;
case AsxParser::ENTRY: case AsxParser::ENTRY:
if (parser->tag_type != TAG_NUM_OF_ITEM_TYPES) break;
parser->tag_builder.AddItem(parser->tag_type,
StringView(s, len));
case AsxParser::TAG:
parser->value.append(s, len);
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