lyrics fetcher: if lyrics weren't found, attempt to search for them globally

This commit is contained in:
Andrzej Rybczak
2010-12-08 23:34:08 +01:00
parent 5a0317eaf3
commit bb4aa9e106
2 changed files with 35 additions and 0 deletions

View File

@@ -38,6 +38,7 @@ LyricsFetcher *lyricsPlugins[] =
new LyricstimeFetcher(),
new MetrolyricsFetcher(),
new LyrcComArFetcher(),
new InternetLyricsFetcher(),
0
};
@@ -239,5 +240,23 @@ void SonglyricsFetcher::postProcess(std::string &data)
LyricsFetcher::postProcess(data);
}
/**********************************************************************/
LyricsFetcher::Result InternetLyricsFetcher::fetch(const std::string &artist, const std::string &title)
{
GoogleLyricsFetcher::fetch(artist, title);
LyricsFetcher::Result result;
result.first = false;
result.second = "The following site may contain lyrics for this song: ";
result.second += URL;
return result;
}
bool InternetLyricsFetcher::isURLOk(const std::string &url)
{
URL = url;
return false;
}
#endif // HAVE_CURL_CURL_H

View File

@@ -160,6 +160,22 @@ struct Sing365Fetcher : public GoogleLyricsFetcher
virtual const char *getCloseTag() { return "<div align"; }
};
struct InternetLyricsFetcher : public GoogleLyricsFetcher
{
virtual const char *name() { return "the Internet"; }
virtual Result fetch(const std::string &artist, const std::string &title);
protected:
virtual const char *getSiteKeyword() { return "lyrics"; }
virtual const char *getOpenTag() { return ""; }
virtual const char *getCloseTag() { return ""; }
virtual bool isURLOk(const std::string &url);
private:
std::string URL;
};
extern LyricsFetcher *lyricsPlugins[];
#endif // HAVE_CURL_CURL_H