Fix fetching information about artists from last.fm
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
* Enable Link Time Optimization by default.
|
* Enable Link Time Optimization by default.
|
||||||
* Enable full sorting of items in the local browser if it's not.
|
* Enable full sorting of items in the local browser if it's not.
|
||||||
* Bind `Play` to `Backspace` by default.
|
* Bind `Play` to `Backspace` by default.
|
||||||
|
* Fix fetching information about artists from last.fm.
|
||||||
|
|
||||||
# ncmpcpp-0.9 (2020-12-20)
|
# ncmpcpp-0.9 (2020-12-20)
|
||||||
* Fix various Mopidy specific bugs.
|
* Fix various Mopidy specific bugs.
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ Service::Result ArtistInfo::processData(const std::string &data)
|
|||||||
unescapeHtmlEntities(url);
|
unescapeHtmlEntities(url);
|
||||||
// fill in language info since url points to english version.
|
// fill in language info since url points to english version.
|
||||||
const auto &lang = m_arguments["lang"];
|
const auto &lang = m_arguments["lang"];
|
||||||
if (!lang.empty())
|
if (!lang.empty() && lang != "en")
|
||||||
boost::replace_first(url, "last.fm/music/", "last.fm/" + lang + "/music/");
|
boost::replace_first(url, "last.fm/music/", "last.fm/" + lang + "/music/");
|
||||||
// ...try to get the content of it...
|
// ...try to get the content of it...
|
||||||
CURLcode code = Curl::perform(wiki, url, "", true);
|
CURLcode code = Curl::perform(wiki, url, "", true);
|
||||||
@@ -138,13 +138,9 @@ Service::Result ArtistInfo::processData(const std::string &data)
|
|||||||
desc = unescapeHtmlUtf8(what[1]);
|
desc = unescapeHtmlUtf8(what[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// otherwise, get rid of CDATA wrapper.
|
|
||||||
rx.assign("<!\\[CDATA\\[(.*)\\]\\]>");
|
|
||||||
desc = boost::regex_replace(desc, rx, "\\1");
|
|
||||||
}
|
|
||||||
stripHtmlTags(desc);
|
stripHtmlTags(desc);
|
||||||
|
// Needs to be done after stripHtmlTags in case there are s there.
|
||||||
|
desc = unescapeHtmlUtf8(desc);
|
||||||
boost::trim(desc);
|
boost::trim(desc);
|
||||||
result.second += desc;
|
result.second += desc;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ std::string unescapeHtmlUtf8(const std::string &data)
|
|||||||
void unescapeHtmlEntities(std::string &s)
|
void unescapeHtmlEntities(std::string &s)
|
||||||
{
|
{
|
||||||
// well, at least some of them.
|
// well, at least some of them.
|
||||||
|
boost::replace_all(s, "'", "'");
|
||||||
boost::replace_all(s, "&", "&");
|
boost::replace_all(s, "&", "&");
|
||||||
boost::replace_all(s, ">", ">");
|
boost::replace_all(s, ">", ">");
|
||||||
boost::replace_all(s, "<", "<");
|
boost::replace_all(s, "<", "<");
|
||||||
|
|||||||
Reference in New Issue
Block a user