Add test for checking whether lyrics fetchers work
This commit is contained in:
1
NEWS
1
NEWS
@@ -21,6 +21,7 @@ ncmpcpp-0.8 (????-??-??)
|
|||||||
* Fixed an issue that could cause some MPD events to be missed.
|
* 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.
|
* Action 'jump_to_playing_song' is not runnable now if there is no playing song.
|
||||||
* Fixed fetching artist info in language other than English.
|
* 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)
|
ncmpcpp-0.7.7 (2016-10-31)
|
||||||
* Fixed compilation on 32bit platforms.
|
* Fixed compilation on 32bit platforms.
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <boost/algorithm/string/trim.hpp>
|
#include <boost/algorithm/string/trim.hpp>
|
||||||
#include <boost/filesystem/operations.hpp>
|
#include <boost/filesystem/operations.hpp>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "bindings.h"
|
#include "bindings.h"
|
||||||
@@ -81,6 +82,7 @@ bool configure(int argc, char **argv)
|
|||||||
("current-song", po::value<std::string>()->implicit_value("{{{(%l) }{{%a - }%t}}|{%f}}"), "print current song using given format and exit")
|
("current-song", po::value<std::string>()->implicit_value("{{{(%l) }{{%a - }%t}}|{%f}}"), "print current song using given format and exit")
|
||||||
("config,c", po::value<std::vector<std::string>>(&config_paths)->default_value(default_config_paths, join<std::string>(default_config_paths, " AND ")), "specify configuration file(s)")
|
("config,c", po::value<std::vector<std::string>>(&config_paths)->default_value(default_config_paths, join<std::string>(default_config_paths, " AND ")), "specify configuration file(s)")
|
||||||
("ignore-config-errors", "ignore unknown and invalid options in configuration files")
|
("ignore-config-errors", "ignore unknown and invalid options in configuration files")
|
||||||
|
("test-lyrics-fetchers", "check if lyrics fetchers work")
|
||||||
("bindings,b", po::value<std::string>(&bindings_path)->default_value("~/.ncmpcpp/bindings"), "specify bindings file")
|
("bindings,b", po::value<std::string>(&bindings_path)->default_value("~/.ncmpcpp/bindings"), "specify bindings file")
|
||||||
("screen,s", po::value<std::string>(), "specify the startup screen")
|
("screen,s", po::value<std::string>(), "specify the startup screen")
|
||||||
("slave-screen,S", po::value<std::string>(), "specify the startup slave screen")
|
("slave-screen,S", po::value<std::string>(), "specify the startup slave screen")
|
||||||
@@ -134,6 +136,34 @@ bool configure(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
po::notify(vm);
|
po::notify(vm);
|
||||||
|
|
||||||
|
if (vm.count("test-lyrics-fetchers"))
|
||||||
|
{
|
||||||
|
std::vector<std::string> fetcher_names = {
|
||||||
|
"lyricwiki",
|
||||||
|
"azlyrics",
|
||||||
|
"genius",
|
||||||
|
"sing365",
|
||||||
|
"lyricsmania",
|
||||||
|
"metrolyrics",
|
||||||
|
"justsomelyrics",
|
||||||
|
"tekstowo",
|
||||||
|
};
|
||||||
|
for (auto &name : fetcher_names)
|
||||||
|
{
|
||||||
|
auto fetcher = boost::lexical_cast<LyricsFetcher_>(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
|
// get home directory
|
||||||
env_home = getenv("HOME");
|
env_home = getenv("HOME");
|
||||||
if (env_home == nullptr)
|
if (env_home == nullptr)
|
||||||
|
|||||||
Reference in New Issue
Block a user