diff options
author | Andrzej Rybczak <electricityispower@gmail.com> | 2010-12-30 19:12:10 +0100 |
---|---|---|
committer | Andrzej Rybczak <electricityispower@gmail.com> | 2010-12-30 19:12:10 +0100 |
commit | 735faa75b9ab91169257831563afd71ffacbe504 (patch) | |
tree | fe3010d05293614872a23bd551af3f640e826f51 /src/lyrics_fetcher.cpp | |
parent | 2002d4dfc64ed0cdf9878a800f7992ed3f089cc6 (diff) |
lyrics fetcher: add a few comments and improve postprocessing of MetrolyricsFetcher
Diffstat (limited to 'src/lyrics_fetcher.cpp')
-rw-r--r-- | src/lyrics_fetcher.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lyrics_fetcher.cpp b/src/lyrics_fetcher.cpp index 9b675852..994202df 100644 --- a/src/lyrics_fetcher.cpp +++ b/src/lyrics_fetcher.cpp @@ -209,6 +209,15 @@ void LyricstimeFetcher::postProcess(std::string &data) void MetrolyricsFetcher::postProcess(std::string &data) { + // throw away [ from ... ] info + size_t i = data.find('['), j = data.find(']'); + if (i != std::string::npos && i != std::string::npos) + data.replace(i, j-i+1, ""); + // some of lyrics have both \n chars and <br />, html tags + // are always present whereas \n chars are not, so we need to + // throw them away to avoid having line breaks doubled. + Replace(data, " ", ""); + Replace(data, "<br />", "\n"); data = unescapeHtmlUtf8(data); LyricsFetcher::postProcess(data); } @@ -233,6 +242,9 @@ void LyricsmaniaFetcher::postProcess(std::string &data) void SonglyricsFetcher::postProcess(std::string &data) { + // throw away [ ... lyrics are found on www.songlyrics.com ] info. + // there is +2 instead of +1 in third line because there is extra + // space after ] we also want to get rid of size_t i = data.find('['), j = data.find(']'); if (i != std::string::npos && i != std::string::npos) data.replace(i, j-i+2, ""); |