Don't treat unknown lyrics fetchers as errors
This commit is contained in:
@@ -458,9 +458,24 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
|
|||||||
p.add("titles_visibility", &titles_visibility, "yes", yes_no);
|
p.add("titles_visibility", &titles_visibility, "yes", yes_no);
|
||||||
p.add("header_text_scrolling", &header_text_scrolling, "yes", yes_no);
|
p.add("header_text_scrolling", &header_text_scrolling, "yes", yes_no);
|
||||||
p.add("cyclic_scrolling", &use_cyclic_scrolling, "no", yes_no);
|
p.add("cyclic_scrolling", &use_cyclic_scrolling, "no", yes_no);
|
||||||
p.add("lyrics_fetchers", &lyrics_fetchers,
|
p.add<void>("lyrics_fetchers", nullptr,
|
||||||
"genius, tekstowo, plyrics, justsomelyrics, jahlyrics, zeneszoveg, internet",
|
"genius, tekstowo, plyrics, justsomelyrics, jahlyrics, zeneszoveg, internet", [this](std::string v) {
|
||||||
list_of<LyricsFetcher_>);
|
lyrics_fetchers = list_of<LyricsFetcher_>(v, [](std::string s) {
|
||||||
|
LyricsFetcher_ fetcher;
|
||||||
|
try {
|
||||||
|
fetcher = boost::lexical_cast<LyricsFetcher_>(s);
|
||||||
|
} catch (boost::bad_lexical_cast &) {
|
||||||
|
std::clog << "Unknown lyrics fetcher: " << s << "\n";
|
||||||
|
}
|
||||||
|
return fetcher;
|
||||||
|
});
|
||||||
|
auto it = std::remove_if(
|
||||||
|
lyrics_fetchers.begin(), lyrics_fetchers.end(),
|
||||||
|
[](const auto &f) { return f.get() == nullptr; });
|
||||||
|
lyrics_fetchers.resize(it - lyrics_fetchers.begin());
|
||||||
|
if (lyrics_fetchers.empty())
|
||||||
|
invalid_value(v);
|
||||||
|
});
|
||||||
p.add("follow_now_playing_lyrics", &now_playing_lyrics, "no", yes_no);
|
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,
|
p.add("fetch_lyrics_for_current_song_in_background", &fetch_lyrics_in_background,
|
||||||
"no", yes_no);
|
"no", yes_no);
|
||||||
|
|||||||
Reference in New Issue
Block a user