Update lyrics fetchers
Removes azlyrics, musixmatch, sing365/lyrics007 and metrolyrics.
This commit is contained in:
@@ -409,7 +409,7 @@
|
||||
#
|
||||
#cyclic_scrolling = no
|
||||
#
|
||||
#lyrics_fetchers = azlyrics, genius, musixmatch, sing365, metrolyrics, justsomelyrics, jahlyrics, plyrics, tekstowo, zeneszoveg, internet
|
||||
#lyrics_fetchers = genius, tekstowo, plyrics, justsomelyrics, jahlyrics, zeneszoveg, internet
|
||||
#
|
||||
#follow_now_playing_lyrics = no
|
||||
#
|
||||
|
||||
@@ -156,14 +156,10 @@ bool configure(int argc, char **argv)
|
||||
if (vm.count("test-lyrics-fetchers"))
|
||||
{
|
||||
std::vector<std::tuple<std::string, std::string, std::string>> fetcher_data = {
|
||||
std::make_tuple("azlyrics", "rihanna", "umbrella"),
|
||||
std::make_tuple("genius", "rihanna", "umbrella"),
|
||||
std::make_tuple("musixmatch", "rihanna", "umbrella"),
|
||||
std::make_tuple("sing365", "rihanna", "umbrella"),
|
||||
std::make_tuple("metrolyrics", "rihanna", "umbrella"),
|
||||
std::make_tuple("justsomelyrics", "rihanna", "umbrella"),
|
||||
std::make_tuple("jahlyrics", "sean kingston", "dry your eyes"),
|
||||
std::make_tuple("plyrics", "offspring", "genocide"),
|
||||
std::make_tuple("plyrics", "rihanna", "umbrella"),
|
||||
std::make_tuple("tekstowo", "rihanna", "umbrella"),
|
||||
std::make_tuple("zeneszoveg", "rihanna", "umbrella"),
|
||||
};
|
||||
|
||||
@@ -38,16 +38,8 @@ std::istream &operator>>(std::istream &is, LyricsFetcher_ &fetcher)
|
||||
{
|
||||
std::string s;
|
||||
is >> s;
|
||||
if (s == "azlyrics")
|
||||
fetcher = std::make_unique<AzLyricsFetcher>();
|
||||
else if (s == "genius")
|
||||
if (s == "genius")
|
||||
fetcher = std::make_unique<GeniusFetcher>();
|
||||
else if (s == "musixmatch")
|
||||
fetcher = std::make_unique<MusixmatchFetcher>();
|
||||
else if (s == "sing365")
|
||||
fetcher = std::make_unique<Sing365Fetcher>();
|
||||
else if (s == "metrolyrics")
|
||||
fetcher = std::make_unique<MetrolyricsFetcher>();
|
||||
else if (s == "justsomelyrics")
|
||||
fetcher = std::make_unique<JustSomeLyricsFetcher>();
|
||||
else if (s == "jahlyrics")
|
||||
@@ -76,7 +68,7 @@ LyricsFetcher::Result LyricsFetcher::fetch(const std::string &artist,
|
||||
std::string url = urlTemplate();
|
||||
boost::replace_all(url, "%artist%", Curl::escape(artist));
|
||||
boost::replace_all(url, "%title%", Curl::escape(title));
|
||||
|
||||
|
||||
std::string data;
|
||||
CURLcode code = Curl::perform(data, url, "", true);
|
||||
|
||||
@@ -88,9 +80,11 @@ LyricsFetcher::Result LyricsFetcher::fetch(const std::string &artist,
|
||||
|
||||
auto lyrics = getContent(regex(), data);
|
||||
|
||||
//std::cerr << "URL: " << url << "\n";
|
||||
//std::cerr << "Data: " << data << "\n";
|
||||
|
||||
if (lyrics.empty() || notLyrics(data))
|
||||
{
|
||||
//std::cerr << "Data: " << data << "\n";
|
||||
//std::cerr << "Empty: " << lyrics.empty() << "\n";
|
||||
//std::cerr << "Not Lyrics: " << notLyrics(data) << "\n";
|
||||
result.second = msgNotFound;
|
||||
@@ -202,14 +196,6 @@ bool GoogleLyricsFetcher::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
|
||||
return GoogleLyricsFetcher::isURLOk(url) && url.find("sitemap") == std::string::npos;
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
LyricsFetcher::Result InternetLyricsFetcher::fetch(const std::string &artist,
|
||||
const std::string &title)
|
||||
{
|
||||
|
||||
@@ -69,34 +69,6 @@ private:
|
||||
const char *URL;
|
||||
};
|
||||
|
||||
struct MusixmatchFetcher : public GoogleLyricsFetcher
|
||||
{
|
||||
virtual const char *name() const override { return "musixmatch.com"; }
|
||||
|
||||
protected:
|
||||
virtual const char *regex() const override { return "<span class=\"lyrics__content__.*?>(.*?)</span>"; }
|
||||
|
||||
virtual void postProcess(std::string &) const override { }
|
||||
};
|
||||
|
||||
struct MetrolyricsFetcher : public GoogleLyricsFetcher
|
||||
{
|
||||
virtual const char *name() const override { return "metrolyrics.com"; }
|
||||
|
||||
protected:
|
||||
virtual const char *regex() const override { return "<div class=\"lyrics-body\">(.*?)<!--WIDGET.*?<!-- Second Section -->(.*?)<!--WIDGET.*?<!-- Third Section -->(.*?)</div>"; }
|
||||
|
||||
virtual bool isURLOk(const std::string &url) override;
|
||||
};
|
||||
|
||||
struct Sing365Fetcher : public GoogleLyricsFetcher
|
||||
{
|
||||
virtual const char *name() const override { return "lyrics007.com"; }
|
||||
|
||||
protected:
|
||||
virtual const char *regex() const override { return "<div class=\"lyrics\">(.*?)</div>"; }
|
||||
};
|
||||
|
||||
struct JustSomeLyricsFetcher : public GoogleLyricsFetcher
|
||||
{
|
||||
virtual const char *name() const override { return "justsomelyrics.com"; }
|
||||
@@ -105,14 +77,6 @@ protected:
|
||||
virtual const char *regex() const override { return "<div class=\"content.*?</div>(.*?)See also"; }
|
||||
};
|
||||
|
||||
struct AzLyricsFetcher : public GoogleLyricsFetcher
|
||||
{
|
||||
virtual const char *name() const override { return "azlyrics.com"; }
|
||||
|
||||
protected:
|
||||
virtual const char *regex() const override { return "<div class=\"lyricsh\">.*?</h2>.*<div>(.*?)</div>"; }
|
||||
};
|
||||
|
||||
struct GeniusFetcher : public GoogleLyricsFetcher
|
||||
{
|
||||
virtual const char *name() const override { return "genius.com"; }
|
||||
@@ -142,7 +106,7 @@ struct TekstowoFetcher : public GoogleLyricsFetcher
|
||||
virtual const char *name() const override { return "tekstowo.pl"; }
|
||||
|
||||
protected:
|
||||
virtual const char *regex() const override { return "<div class=\"song-text\".*?>.*?</h2>(.*?)<a"; }
|
||||
virtual const char *regex() const override { return "<div class=\"inner-text\">(.*?)</div>"; }
|
||||
};
|
||||
|
||||
struct ZeneszovegFetcher : public GoogleLyricsFetcher
|
||||
@@ -150,7 +114,7 @@ struct ZeneszovegFetcher : public GoogleLyricsFetcher
|
||||
virtual const char *name() const override { return "zeneszoveg.hu"; }
|
||||
|
||||
protected:
|
||||
virtual const char *regex() const override { return "<div class=\"lyrics-plain-text.*?\">(.*?)</div>"; }
|
||||
virtual const char *regex() const override { return "<div id=\"tartalom_slide_content\"> (.*?)<style>"; }
|
||||
};
|
||||
|
||||
struct InternetLyricsFetcher : public GoogleLyricsFetcher
|
||||
|
||||
@@ -459,7 +459,7 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
|
||||
p.add("header_text_scrolling", &header_text_scrolling, "yes", yes_no);
|
||||
p.add("cyclic_scrolling", &use_cyclic_scrolling, "no", yes_no);
|
||||
p.add("lyrics_fetchers", &lyrics_fetchers,
|
||||
"azlyrics, genius, musixmatch, sing365, metrolyrics, justsomelyrics, jahlyrics, plyrics, tekstowo, zeneszoveg, internet",
|
||||
"genius, tekstowo, plyrics, justsomelyrics, jahlyrics, zeneszoveg, internet",
|
||||
list_of<LyricsFetcher_>);
|
||||
p.add("follow_now_playing_lyrics", &now_playing_lyrics, "no", yes_no);
|
||||
p.add("fetch_lyrics_for_current_song_in_background", &fetch_lyrics_in_background,
|
||||
|
||||
Reference in New Issue
Block a user