lyrics fetcher: add lyricwiki.com database support

This commit is contained in:
Andrzej Rybczak
2010-08-09 13:14:07 +02:00
parent 96064b826e
commit 26b7218f8e
2 changed files with 98 additions and 13 deletions

View File

@@ -43,6 +43,8 @@ struct LyricsFetcher
virtual bool notLyrics(GNUC_UNUSED const std::string &data) { return false; }
virtual void postProcess(std::string &data);
bool getContent(const char *open_tag, const char *close_tag, std::string &data);
};
struct LyrcComArFetcher : public LyricsFetcher
@@ -55,6 +57,22 @@ struct LyrcComArFetcher : public LyricsFetcher
virtual const char *getCloseTag() { return "<p>"; }
};
struct LyricwikiFetcher : public LyricsFetcher
{
virtual const char *name() { return "lyricwiki.com"; }
virtual Result fetch(const std::string &artist, const std::string &title);
protected:
virtual const char *getURL() { return "http://lyrics.wikia.com/api.php?action=lyrics&fmt=xml&func=getSong&artist=%artist%&song=%title%"; }
virtual const char *getOpenTag() { return "<url>"; }
virtual const char *getCloseTag() { return "</url>"; }
virtual bool notLyrics(const std::string &data);
private:
std::string unescape(const std::string &data);
};
struct LyricsflyFetcher : public LyricsFetcher
{
virtual const char *name() { return "lyricsfly.com"; }