Merge branch '0.7.x'

This commit is contained in:
Andrzej Rybczak
2016-11-01 00:46:07 +01:00
3 changed files with 17 additions and 21 deletions

3
NEWS
View File

@@ -2,6 +2,9 @@ ncmpcpp-0.8 (????-??-??)
* Configuration variable 'execute_on_player_state_change' was added.
* Support for controlling whether ncmpcpp should display multiple tags as-is or make an effort to hide duplicate values (show_duplicate_tags configuration variable, enabled by default).
ncmpcpp-0.7.7 (2016-10-31)
* Fixed compilation on 32bit platforms.
ncmpcpp-0.7.6 (2016-10-30)
* Fixed assertion failure on trying to search backwards in an empty list.
* Updated installation instructions in INSTALL file.

View File

@@ -109,7 +109,7 @@ void LyricsFetcher::postProcess(std::string &data) const
stripHtmlTags(data);
// Remove indentation from each line and collapse multiple newlines into one.
std::vector<std::string> lines;
boost::split(lines, data, boost::is_any_of("\r\n"));
boost::split(lines, data, boost::is_any_of("\n"));
for (auto &line : lines)
boost::trim(line);
std::unique(lines.begin(), lines.end(), [](std::string &a, std::string &b) {

View File

@@ -62,29 +62,22 @@ void unescapeHtmlEntities(std::string &s)
void stripHtmlTags(std::string &s)
{
bool erase = 0;
bool is_p, is_slash_p;
for (size_t i = s.find("<"); i != std::string::npos; i = s.find("<"))
{
size_t j = s.find(">", i)+1;
if (s.compare(i, std::min(3ul, j-i), "<p ") == 0 || s.compare(i, j-i, "</p>") == 0)
s.replace(i, j-i, "\n");
size_t j = s.find(">", i);
if (j != std::string::npos)
{
++j;
is_p = s.compare(i, j-i, "<p ") == 0 || s.compare(i, j-i, "<p>") == 0;
is_slash_p = s.compare(i, j-i, "</p>") == 0;
if (is_p || is_slash_p)
s.replace(i, j-i, "\n");
else
s.replace(i, j-i, "");
}
else
s.replace(i, j-i, "");
break;
}
unescapeHtmlEntities(s);
for (size_t i = 0; i < s.length(); ++i)
{
if (erase)
{
s.erase(s.begin()+i);
erase = 0;
}
if (s[i] == 13) // ascii code for windows line ending, get rid of this shit
{
s[i] = '\n';
erase = 1;
}
else if (s[i] == '\t')
s[i] = ' ';
}
}