diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f89bdc2..dcbd8029 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * Enable Link Time Optimization by default. * Enable full sorting of items in the local browser if it's not. * Bind `Play` to `Backspace` by default. +* Fix fetching information about artists from last.fm. # ncmpcpp-0.9 (2020-12-20) * Fix various Mopidy specific bugs. diff --git a/src/lastfm_service.cpp b/src/lastfm_service.cpp index 39432adc..ace3cb89 100644 --- a/src/lastfm_service.cpp +++ b/src/lastfm_service.cpp @@ -120,11 +120,11 @@ Service::Result ArtistInfo::processData(const std::string &data) unescapeHtmlEntities(url); // fill in language info since url points to english version. 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/"); // ...try to get the content of it... CURLcode code = Curl::perform(wiki, url, "", true); - + if (code != CURLE_OK) { result.second = curl_easy_strerror(code); @@ -138,13 +138,9 @@ Service::Result ArtistInfo::processData(const std::string &data) desc = unescapeHtmlUtf8(what[1]); } } - else - { - // otherwise, get rid of CDATA wrapper. - rx.assign(""); - desc = boost::regex_replace(desc, rx, "\\1"); - } stripHtmlTags(desc); + // Needs to be done after stripHtmlTags in case there are s there. + desc = unescapeHtmlUtf8(desc); boost::trim(desc); result.second += desc; } diff --git a/src/utility/html.cpp b/src/utility/html.cpp index 031f258e..9ef71bec 100644 --- a/src/utility/html.cpp +++ b/src/utility/html.cpp @@ -54,6 +54,7 @@ std::string unescapeHtmlUtf8(const std::string &data) void unescapeHtmlEntities(std::string &s) { // well, at least some of them. + boost::replace_all(s, "'", "'"); boost::replace_all(s, "&", "&"); boost::replace_all(s, ">", ">"); boost::replace_all(s, "<", "<");