Fixed xml attributes sometimes not written
This commit is contained in:
@@ -193,18 +193,6 @@ namespace lms::api::subsonic
|
|||||||
std::function<boost::property_tree::ptree(const Node&)> nodeToPropertyTree = [&](const Node& node) {
|
std::function<boost::property_tree::ptree(const Node&)> nodeToPropertyTree = [&](const Node& node) {
|
||||||
boost::property_tree::ptree res;
|
boost::property_tree::ptree res;
|
||||||
|
|
||||||
for (const auto& [key, value] : node._attributes)
|
|
||||||
{
|
|
||||||
if (std::holds_alternative<Node::string>(value))
|
|
||||||
res.put("<xmlattr>." + std::string{ key.str() }, std::get<Node::string>(value));
|
|
||||||
else if (std::holds_alternative<bool>(value))
|
|
||||||
res.put("<xmlattr>." + std::string{ key.str() }, std::get<bool>(value));
|
|
||||||
else if (std::holds_alternative<float>(value))
|
|
||||||
res.put("<xmlattr>." + std::string{ key.str() }, std::get<float>(value));
|
|
||||||
else if (std::holds_alternative<long long>(value))
|
|
||||||
res.put("<xmlattr>." + std::string{ key.str() }, std::get<long long>(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
auto valueToPropertyTree = [](const Node::ValueType& value) {
|
auto valueToPropertyTree = [](const Node::ValueType& value) {
|
||||||
boost::property_tree::ptree res;
|
boost::property_tree::ptree res;
|
||||||
std::visit([&](const auto& rawValue) {
|
std::visit([&](const auto& rawValue) {
|
||||||
@@ -239,6 +227,20 @@ namespace lms::api::subsonic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const auto& [key, value] : node._attributes)
|
||||||
|
{
|
||||||
|
if (std::holds_alternative<Node::string>(value))
|
||||||
|
res.put("<xmlattr>." + std::string{ key.str() }, std::get<Node::string>(value));
|
||||||
|
else if (std::holds_alternative<bool>(value))
|
||||||
|
res.put("<xmlattr>." + std::string{ key.str() }, std::get<bool>(value));
|
||||||
|
else if (std::holds_alternative<float>(value))
|
||||||
|
res.put("<xmlattr>." + std::string{ key.str() }, std::get<float>(value));
|
||||||
|
else if (std::holds_alternative<long long>(value))
|
||||||
|
res.put("<xmlattr>." + std::string{ key.str() }, std::get<long long>(value));
|
||||||
|
else
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user