Add support for fetching lyrics from musixmatch.com
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
# ncmpcpp-0.10 (????-??-??)
|
||||
* Add support for fetching lyrics from musixmatch.com.
|
||||
|
||||
# ncmpcpp-0.9 (2020-12-20)
|
||||
* Fix various Mopidy specific bugs.
|
||||
* Add `run_external_console_command` action for running terminal applications.
|
||||
|
||||
@@ -405,7 +405,7 @@
|
||||
#
|
||||
#cyclic_scrolling = no
|
||||
#
|
||||
#lyrics_fetchers = azlyrics, genius, sing365, metrolyrics, justsomelyrics, jahlyrics, plyrics, tekstowo, zeneszoveg, internet
|
||||
#lyrics_fetchers = azlyrics, genius, musixmatch, sing365, metrolyrics, justsomelyrics, jahlyrics, plyrics, tekstowo, zeneszoveg, internet
|
||||
#
|
||||
#follow_now_playing_lyrics = no
|
||||
#
|
||||
|
||||
@@ -158,6 +158,7 @@ bool configure(int argc, char **argv)
|
||||
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"),
|
||||
|
||||
@@ -42,6 +42,8 @@ std::istream &operator>>(std::istream &is, LyricsFetcher_ &fetcher)
|
||||
fetcher = std::make_unique<AzLyricsFetcher>();
|
||||
else 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")
|
||||
@@ -83,7 +85,7 @@ LyricsFetcher::Result LyricsFetcher::fetch(const std::string &artist,
|
||||
result.second = curl_easy_strerror(code);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
auto lyrics = getContent(regex(), data);
|
||||
|
||||
if (lyrics.empty() || notLyrics(data))
|
||||
@@ -91,7 +93,7 @@ LyricsFetcher::Result LyricsFetcher::fetch(const std::string &artist,
|
||||
result.second = msgNotFound;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
data.clear();
|
||||
for (auto it = lyrics.begin(); it != lyrics.end(); ++it)
|
||||
{
|
||||
@@ -183,7 +185,7 @@ LyricsFetcher::Result GoogleLyricsFetcher::fetch(const std::string &artist,
|
||||
result.second = msgNotFound;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
data = unescapeHtmlUtf8(urls[0]);
|
||||
|
||||
URL = data.c_str();
|
||||
|
||||
@@ -69,6 +69,16 @@ 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"; }
|
||||
|
||||
@@ -477,7 +477,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, sing365, metrolyrics, justsomelyrics, jahlyrics, plyrics, tekstowo, zeneszoveg, internet",
|
||||
"azlyrics, genius, musixmatch, sing365, metrolyrics, justsomelyrics, jahlyrics, plyrics, tekstowo, 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