Merge branch '0.6.x'
This commit is contained in:
7
NEWS
7
NEWS
@@ -20,6 +20,13 @@ ncmpcpp-0.7 (????-??-??)
|
||||
* BOOST_LIB_SUFFIX configure variable is now empty by default.
|
||||
* Shuffle function now shuffles only selected range if selection in playlist is active.
|
||||
|
||||
ncmpcpp-0.6.4 (2015-05-02)
|
||||
|
||||
* Fix title of a pop-up which shows during adding selected items to the current playlist.
|
||||
* Correctly deal with leading separator while parsing filenames in tag editor.
|
||||
* Fix initial incorrect window size that was occuring in some cases.
|
||||
* Unknown and invalid configuration options can now be ignored using command line option 'ignore-config-errors'.
|
||||
|
||||
ncmpcpp-0.6.3 (2015-03-02)
|
||||
|
||||
* Fix floating point exception when adding a specific number of random items.
|
||||
|
||||
@@ -78,6 +78,7 @@ bool configure(int argc, char **argv)
|
||||
("host,h", po::value<std::string>()->default_value("localhost"), "connect to server at host")
|
||||
("port,p", po::value<int>()->default_value(6600), "connect to server at port")
|
||||
("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", po::value<bool>()->default_value(false), "ignore unknown and invalid options in configuration files")
|
||||
("bindings,b", po::value<std::string>(&bindings_path)->default_value("~/.ncmpcpp/bindings"), "specify bindings file")
|
||||
("screen,s", po::value<std::string>(), "specify initial screen")
|
||||
("slave-screen,S", po::value<std::string>(), "specify initial slave screen")
|
||||
@@ -150,7 +151,7 @@ bool configure(int argc, char **argv)
|
||||
|
||||
// read configuration
|
||||
std::for_each(config_paths.begin(), config_paths.end(), expand_home);
|
||||
if (Config.read(config_paths) == false)
|
||||
if (Config.read(config_paths, vm["ignore-config-errors"].as<bool>()) == false)
|
||||
exit(1);
|
||||
|
||||
// if bindings file was not specified, use the one from main directory.
|
||||
|
||||
@@ -103,6 +103,13 @@ int main(int argc, char **argv)
|
||||
cerr_buffer = std::cerr.rdbuf();
|
||||
std::cerr.rdbuf(errorlog.rdbuf());
|
||||
|
||||
# ifndef WIN32
|
||||
signal(SIGPIPE, sighandler);
|
||||
signal(SIGWINCH, sighandler);
|
||||
// ignore Ctrl-C
|
||||
sigignore(SIGINT);
|
||||
# endif // !WIN32
|
||||
|
||||
NC::initScreen(Config.colors_enabled);
|
||||
|
||||
Actions::OriginalStatusbarVisibility = Config.statusbar_visibility;
|
||||
@@ -151,12 +158,6 @@ int main(int argc, char **argv)
|
||||
if (Config.mouse_support)
|
||||
mousemask(ALL_MOUSE_EVENTS, 0);
|
||||
|
||||
signal(SIGWINCH, sighandler);
|
||||
// we get it after connection with mpd is broken.
|
||||
// just ignore it and wait for the connection to
|
||||
// be reestablished.
|
||||
sigignore(SIGPIPE);
|
||||
|
||||
while (!Actions::ExitMainLoop)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -70,7 +70,7 @@ SelectedItemsAdder::SelectedItemsAdder()
|
||||
MainStartY+(MainHeight-m_position_selector_height)/2,
|
||||
m_position_selector_width,
|
||||
m_position_selector_height,
|
||||
"Scroll?",
|
||||
"Where?",
|
||||
Config.main_color,
|
||||
Config.window_border
|
||||
);
|
||||
|
||||
@@ -190,7 +190,7 @@ option_parser::worker border(NC::Border &arg, NC::Border value)
|
||||
|
||||
}
|
||||
|
||||
bool Configuration::read(const std::vector<std::string> &config_paths)
|
||||
bool Configuration::read(const std::vector<std::string> &config_paths, bool ignore_errors)
|
||||
{
|
||||
std::string mpd_host;
|
||||
unsigned mpd_port;
|
||||
@@ -678,13 +678,13 @@ bool Configuration::read(const std::vector<std::string> &config_paths)
|
||||
return std::all_of(
|
||||
config_paths.begin(),
|
||||
config_paths.end(),
|
||||
[&p](const std::string &config_path) {
|
||||
[&](const std::string &config_path) {
|
||||
std::ifstream f(config_path);
|
||||
if (f.is_open())
|
||||
std::clog << "Reading configuration from " << config_path << "...\n";
|
||||
return p.run(f);
|
||||
return p.run(f, ignore_errors);
|
||||
}
|
||||
) && p.initialize_undefined();
|
||||
) && p.initialize_undefined(ignore_errors);
|
||||
}
|
||||
|
||||
/* vim: set tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab : */
|
||||
|
||||
@@ -53,7 +53,7 @@ struct Configuration
|
||||
: playlist_disable_highlight_delay(0), visualizer_sync_interval(0)
|
||||
{ }
|
||||
|
||||
bool read(const std::vector<std::string> &config_paths);
|
||||
bool read(const std::vector<std::string> &config_paths, bool ignore_errors);
|
||||
|
||||
std::string ncmpcpp_directory;
|
||||
std::string lyrics_directory;
|
||||
|
||||
@@ -1066,7 +1066,12 @@ std::string ParseFilename(MPD::MutableSong &s, std::string mask, bool preview)
|
||||
std::vector< std::pair<char, std::string> > tags;
|
||||
std::string file = s.getName().substr(0, s.getName().rfind("."));
|
||||
|
||||
for (size_t i = mask.find("%"); i != std::string::npos; i = mask.find("%"))
|
||||
size_t i = mask.find("%");
|
||||
|
||||
if (!mask.substr(0, i).empty())
|
||||
file = file.substr(i);
|
||||
|
||||
for (; i != std::string::npos; i = mask.find("%"))
|
||||
{
|
||||
tags.push_back(std::make_pair(mask.at(i+1), ""));
|
||||
mask = mask.substr(i+2);
|
||||
@@ -1074,7 +1079,7 @@ std::string ParseFilename(MPD::MutableSong &s, std::string mask, bool preview)
|
||||
if (!mask.empty())
|
||||
separators.push_back(mask.substr(0, i));
|
||||
}
|
||||
size_t i = 0;
|
||||
i = 0;
|
||||
for (auto it = separators.begin(); it != separators.end(); ++it, ++i)
|
||||
{
|
||||
size_t j = file.find(*it);
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
#include "utility/option_parser.h"
|
||||
|
||||
bool option_parser::run(std::istream &is)
|
||||
bool option_parser::run(std::istream &is, bool ignore_errors)
|
||||
{
|
||||
// quoted value. leftmost and rightmost quotation marks are the delimiters.
|
||||
boost::regex quoted("(\\w+)\\h*=\\h*\"(.*)\"[^\"]*");
|
||||
@@ -56,12 +56,14 @@ bool option_parser::run(std::istream &is)
|
||||
it->second.parse(match[2]);
|
||||
} catch (std::exception &e) {
|
||||
std::cerr << "Error while processing option \"" << option << "\": " << e.what() << "\n";
|
||||
if (!ignore_errors)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Unknown option: " << option << "\n";
|
||||
if (!ignore_errors)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -69,7 +71,7 @@ bool option_parser::run(std::istream &is)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool option_parser::initialize_undefined()
|
||||
bool option_parser::initialize_undefined(bool ignore_errors)
|
||||
{
|
||||
for (auto &p : m_parsers)
|
||||
{
|
||||
@@ -79,6 +81,7 @@ bool option_parser::initialize_undefined()
|
||||
p.second.run_default();
|
||||
} catch (std::exception &e) {
|
||||
std::cerr << "Error while initializing option \"" << p.first << "\": " << e.what() << "\n";
|
||||
if (ignore_errors)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,8 +139,8 @@ struct option_parser
|
||||
m_parsers[option] = std::forward<WorkerT>(w);
|
||||
}
|
||||
|
||||
bool run(std::istream &is);
|
||||
bool initialize_undefined();
|
||||
bool run(std::istream &is, bool ignore_errors);
|
||||
bool initialize_undefined(bool ignore_errors);
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, worker> m_parsers;
|
||||
|
||||
Reference in New Issue
Block a user