diff --git a/NEWS b/NEWS index 060cef97..6559d298 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,7 @@ ncmpcpp-0.8 (????-??-??) * Fixed an issue that could cause some MPD events to be missed. * Action 'jump_to_playing_song' is not runnable now if there is no playing song. * Fixed fetching artist info in language other than English. +* Added test that checks if lyrics fetchers work (available via command line parameter --test-lyrics-fetchers). ncmpcpp-0.7.7 (2016-10-31) * Fixed compilation on 32bit platforms. diff --git a/src/configuration.cpp b/src/configuration.cpp index b179f38e..8c25312d 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "bindings.h" @@ -81,6 +82,7 @@ bool configure(int argc, char **argv) ("current-song", po::value()->implicit_value("{{{(%l) }{{%a - }%t}}|{%f}}"), "print current song using given format and exit") ("config,c", po::value>(&config_paths)->default_value(default_config_paths, join(default_config_paths, " AND ")), "specify configuration file(s)") ("ignore-config-errors", "ignore unknown and invalid options in configuration files") + ("test-lyrics-fetchers", "check if lyrics fetchers work") ("bindings,b", po::value(&bindings_path)->default_value("~/.ncmpcpp/bindings"), "specify bindings file") ("screen,s", po::value(), "specify the startup screen") ("slave-screen,S", po::value(), "specify the startup slave screen") @@ -134,6 +136,34 @@ bool configure(int argc, char **argv) } po::notify(vm); + + if (vm.count("test-lyrics-fetchers")) + { + std::vector fetcher_names = { + "lyricwiki", + "azlyrics", + "genius", + "sing365", + "lyricsmania", + "metrolyrics", + "justsomelyrics", + "tekstowo", + }; + for (auto &name : fetcher_names) + { + auto fetcher = boost::lexical_cast(name); + std::cout << std::setw(20) + << std::left + << fetcher->name() + << " : " + << std::flush; + auto result = fetcher->fetch("rihanna", "umbrella"); + std::cout << (result.first ? "ok" : "failed") + << "\n"; + } + exit(0); + } + // get home directory env_home = getenv("HOME"); if (env_home == nullptr)