lyrics fetcher: add sing365.com db support + a few corrections
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
LyricsFetcher *lyricsPlugins[] =
|
LyricsFetcher *lyricsPlugins[] =
|
||||||
{
|
{
|
||||||
new LyricwikiFetcher(),
|
new LyricwikiFetcher(),
|
||||||
|
new Sing365Fetcher(),
|
||||||
new LyriczzFetcher(),
|
new LyriczzFetcher(),
|
||||||
new SonglyricsFetcher(),
|
new SonglyricsFetcher(),
|
||||||
new LyricsmaniaFetcher(),
|
new LyricsmaniaFetcher(),
|
||||||
@@ -181,15 +182,14 @@ LyricsFetcher::Result GoogleLyricsFetcher::fetch(const std::string &artist, cons
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data = unescapeHtmlUtf8(data);
|
||||||
|
//result.second = data;
|
||||||
|
//return result;
|
||||||
|
|
||||||
URL = data.c_str();
|
URL = data.c_str();
|
||||||
return LyricsFetcher::fetch("", "");
|
return LyricsFetcher::fetch("", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GoogleLyricsFetcher::notLyrics(const std::string &data)
|
|
||||||
{
|
|
||||||
return LyricsFetcher::notLyrics(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GoogleLyricsFetcher::isURLOk(const std::string &url)
|
bool GoogleLyricsFetcher::isURLOk(const std::string &url)
|
||||||
{
|
{
|
||||||
return url.find(getSiteKeyword()) != std::string::npos;
|
return url.find(getSiteKeyword()) != std::string::npos;
|
||||||
@@ -224,7 +224,7 @@ void MetrolyricsFetcher::postProcess(std::string &data)
|
|||||||
bool MetrolyricsFetcher::isURLOk(const std::string &url)
|
bool MetrolyricsFetcher::isURLOk(const std::string &url)
|
||||||
{
|
{
|
||||||
// it sometimes return link to sitemap.xml, which is huge so we need to discard it
|
// it sometimes return link to sitemap.xml, which is huge so we need to discard it
|
||||||
return GoogleLyricsFetcher::isURLOk(url) && url.find("sitemap.xml") == std::string::npos;
|
return GoogleLyricsFetcher::isURLOk(url) && url.find("sitemap") == std::string::npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ struct LyricsFetcher
|
|||||||
virtual const char *getOpenTag() = 0;
|
virtual const char *getOpenTag() = 0;
|
||||||
virtual const char *getCloseTag() = 0;
|
virtual const char *getCloseTag() = 0;
|
||||||
|
|
||||||
virtual bool notLyrics(GNUC_UNUSED const std::string &data) { return false; }
|
virtual bool notLyrics(const std::string &) { return false; }
|
||||||
virtual void postProcess(std::string &data);
|
virtual void postProcess(std::string &data);
|
||||||
|
|
||||||
bool getContent(const char *open_tag, const char *close_tag, std::string &data);
|
bool getContent(const char *open_tag, const char *close_tag, std::string &data);
|
||||||
@@ -94,8 +94,8 @@ struct GoogleLyricsFetcher : public LyricsFetcher
|
|||||||
virtual const char *getSiteKeyword() = 0;
|
virtual const char *getSiteKeyword() = 0;
|
||||||
virtual const char *getURL() { return URL; }
|
virtual const char *getURL() { return URL; }
|
||||||
|
|
||||||
virtual bool notLyrics(const std::string &data);
|
|
||||||
virtual bool isURLOk(const std::string &url);
|
virtual bool isURLOk(const std::string &url);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char *URL;
|
const char *URL;
|
||||||
};
|
};
|
||||||
@@ -160,8 +160,16 @@ struct LyriczzFetcher : public GoogleLyricsFetcher
|
|||||||
virtual const char *getSiteKeyword() { return "lyriczz"; }
|
virtual const char *getSiteKeyword() { return "lyriczz"; }
|
||||||
virtual const char *getOpenTag() { return "border=0 /></a>"; }
|
virtual const char *getOpenTag() { return "border=0 /></a>"; }
|
||||||
virtual const char *getCloseTag() { return "<a href"; }
|
virtual const char *getCloseTag() { return "<a href"; }
|
||||||
|
};
|
||||||
//virtual void postProcess(std::string &data);
|
|
||||||
|
struct Sing365Fetcher : public GoogleLyricsFetcher
|
||||||
|
{
|
||||||
|
virtual const char *name() { return "sing365.com"; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const char *getSiteKeyword() { return "sing365"; }
|
||||||
|
virtual const char *getOpenTag() { return "<br><br></div>"; }
|
||||||
|
virtual const char *getCloseTag() { return "<div align"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
extern LyricsFetcher *lyricsPlugins[];
|
extern LyricsFetcher *lyricsPlugins[];
|
||||||
|
|||||||
Reference in New Issue
Block a user