Skip to content

Commit

Permalink
Subsonic API: handle xml for new fields
Browse files Browse the repository at this point in the history
  • Loading branch information
epoupon committed Oct 6, 2023
1 parent de10da8 commit 5d49bac
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/libs/subsonic/impl/SubsonicResponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,23 +209,29 @@ namespace API::Subsonic
res.put_value(std::get<std::string>(value));
else if (std::holds_alternative<bool>(value))
res.put_value(std::get<bool>(value));
else if (std::holds_alternative<float>(value))
res.put_value(std::get<float>(value));
else if (std::holds_alternative<long long>(value))
res.put_value(std::get<long long>(value));
}
else
{
for (auto itChildNode : node._children)
for (const auto& [key, childNodes] : node._children)
{
for (const Response::Node& childNode : itChildNode.second)
res.add_child(itChildNode.first, nodeToPropertyTree(childNode));
for (const Response::Node& childNode : childNodes)
res.add_child(key, nodeToPropertyTree(childNode));
}

for (auto itChildArrayNode : node._childrenArrays)
for (const auto& [key, childArrayNodes] : node._childrenArrays)
{
const std::vector<Response::Node>& childArrayNodes{ itChildArrayNode.second };

for (const Response::Node& childNode : childArrayNodes)
res.add_child(itChildArrayNode.first, nodeToPropertyTree(childNode));
res.add_child(key, nodeToPropertyTree(childNode));
}

for (const auto& [key, childArrayValues] : node._childrenValues)
{
for (const std::string& value : childArrayValues)
res.add_child(key, boost::property_tree::ptree{ value });
}
}

Expand Down

0 comments on commit 5d49bac

Please sign in to comment.