Make the list of lyrics fetchers customizable
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
|
||||
#ifdef HAVE_CURL_CURL_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
struct LyricsFetcher
|
||||
@@ -46,6 +47,12 @@ protected:
|
||||
static const char msgNotFound[];
|
||||
};
|
||||
|
||||
typedef std::vector<std::unique_ptr<LyricsFetcher>> LyricsFetchers;
|
||||
|
||||
std::unique_ptr<LyricsFetcher> toLyricsFetcher(const std::string &s);
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
struct LyricwikiFetcher : public LyricsFetcher
|
||||
{
|
||||
virtual const char *name() const override { return "lyricwiki.com"; }
|
||||
@@ -116,7 +123,7 @@ protected:
|
||||
virtual const char *regex() const override { return "<div class=\"lyricsh\">.*?</h2>.*<div>(.*?)</div>"; }
|
||||
};
|
||||
|
||||
struct GeniusLyricsFetcher : public GoogleLyricsFetcher
|
||||
struct GeniusFetcher : public GoogleLyricsFetcher
|
||||
{
|
||||
virtual const char *name() const override { return "genius.com"; }
|
||||
|
||||
@@ -124,7 +131,7 @@ protected:
|
||||
virtual const char *regex() const override { return "<lyrics.*?>(.*?)</lyrics>"; }
|
||||
};
|
||||
|
||||
struct TekstowoLyricsFetcher : public GoogleLyricsFetcher
|
||||
struct TekstowoFetcher : public GoogleLyricsFetcher
|
||||
{
|
||||
virtual const char *name() const override { return "tekstowo.pl"; }
|
||||
|
||||
@@ -147,8 +154,6 @@ private:
|
||||
std::string URL;
|
||||
};
|
||||
|
||||
extern LyricsFetcher *lyricsPlugins[];
|
||||
|
||||
#endif // HAVE_CURL_CURL_H
|
||||
|
||||
#endif // NCMPCPP_LYRICS_FETCHER_H
|
||||
|
||||
Reference in New Issue
Block a user