From d9c55771bb1059671486b1df245075e10bd6e853 Mon Sep 17 00:00:00 2001 From: V Date: Sun, 24 Jan 2021 19:15:59 +0100 Subject: [PATCH] configuration: add mpd_password option (#407) Although this can already be set via mpd_host, having a separate option is cleaner, and doesn't require setting the host when ncmpcpp already detects it correctly. --- AUTHORS | 1 + CHANGELOG.md | 1 + doc/config | 2 ++ doc/ncmpcpp.1 | 3 +++ src/settings.cpp | 4 ++++ 5 files changed, 11 insertions(+) diff --git a/AUTHORS b/AUTHORS index 85642200..9249a29e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -46,3 +46,4 @@ Trygve Aaberge Wieland Hoffmann Wojciech Siewierski Yannick LM +V diff --git a/CHANGELOG.md b/CHANGELOG.md index c4b29044..303a3531 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # ncmpcpp-0.10 (????-??-??) +* Add the configuration option `mpd_password`. # ncmpcpp-0.9.2 (2021-01-24) * Revert suppression of output of all external commands as that makes e.g album diff --git a/doc/config b/doc/config index 88893cff..57c8f9a9 100644 --- a/doc/config +++ b/doc/config @@ -27,6 +27,8 @@ # #mpd_port = 6600 # +#mpd_password = "" +# #mpd_connection_timeout = 5 # ## Needed for tag editor and file operations to work. diff --git a/doc/ncmpcpp.1 b/doc/ncmpcpp.1 index 6ef2745c..ff2669ac 100644 --- a/doc/ncmpcpp.1 +++ b/doc/ncmpcpp.1 @@ -74,6 +74,9 @@ Connect to MPD running on specified host/unix socket. When HOST starts with a '/ .B mpd_port = PORT Connect to MPD on the specified port. Note: MPD_PORT environment variable overrides this setting. .TP +.B mpd_password = PASSWORD +Use PASSWORD to authenticate to MPD. +.TP .B mpd_music_dir = PATH Search for files in specified directory. This is needed for tag editor to work. .TP diff --git a/src/settings.cpp b/src/settings.cpp index 80a2b4e3..f0032683 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -244,6 +244,10 @@ bool Configuration::read(const std::vector &config_paths, bool igno p.add("mpd_port", nullptr, "6600", [](std::string port) { Mpd.SetPort(verbose_lexical_cast(port)); }); + p.add("mpd_password", nullptr, "", [](std::string password) { + if (!password.empty()) + Mpd.SetPassword(password); + }); p.add("mpd_music_dir", &mpd_music_dir, "~/music", adjust_directory); p.add("mpd_connection_timeout", &mpd_connection_timeout, "5"); p.add("mpd_crossfade_time", &crossfade_time, "5");