add config options for communication mode with mpd (polling for default)
idle support in ncmpcpp is marked experimental since its support in mpd is not ready for general use in full featured clients (see bug 2612)
This commit is contained in:
@@ -72,7 +72,7 @@ bool Connection::Connect()
|
||||
if (!itsPassword.empty())
|
||||
SendPassword();
|
||||
itsFD = mpd_connection_get_fd(itsConnection);
|
||||
supportsIdle = Version() > 13;
|
||||
supportsIdle = isIdleEnabled && Version() > 13;
|
||||
// in UpdateStatus() we compare it to itsElapsedTimer[0],
|
||||
// and for the first time it has always evaluate to true
|
||||
// so we need it to be zero at this point
|
||||
|
||||
@@ -94,6 +94,7 @@ namespace MPD
|
||||
|
||||
float Version() const;
|
||||
|
||||
void SetIdleEnabled(bool val) { isIdleEnabled = val; }
|
||||
bool SupportsIdle() const { return supportsIdle; }
|
||||
void OrderDataFetching() { hasData = 1; }
|
||||
int GetFD() const { return itsFD; }
|
||||
@@ -223,6 +224,7 @@ namespace MPD
|
||||
|
||||
int itsFD;
|
||||
bool isIdle;
|
||||
bool isIdleEnabled;
|
||||
bool supportsIdle;
|
||||
bool hasData;
|
||||
|
||||
|
||||
@@ -241,6 +241,7 @@ int main(int argc, char *argv[])
|
||||
Mpd.SetPort(Config.mpd_port);
|
||||
|
||||
Mpd.SetTimeout(Config.mpd_connection_timeout);
|
||||
Mpd.SetIdleEnabled(Config.enable_idle_notifications);
|
||||
|
||||
if (argc > 1)
|
||||
ParseArgv(argc, argv);
|
||||
|
||||
@@ -284,6 +284,7 @@ void DefaultConfiguration(ncmpcpp_config &conf)
|
||||
conf.window_border = brGreen;
|
||||
conf.active_window_border = brRed;
|
||||
conf.media_lib_primary_tag = MPD_TAG_ARTIST;
|
||||
conf.enable_idle_notifications = false;
|
||||
conf.colors_enabled = true;
|
||||
conf.fancy_scrolling = true;
|
||||
conf.playlist_show_remaining_time = false;
|
||||
@@ -715,6 +716,10 @@ void ReadConfiguration(ncmpcpp_config &conf)
|
||||
if (!v.empty())
|
||||
conf.color2 = IntoColor(v);
|
||||
}
|
||||
else if (cl.find("mpd_communication_mode") != std::string::npos)
|
||||
{
|
||||
conf.enable_idle_notifications = v == "notifications";
|
||||
}
|
||||
else if (cl.find("colors_enabled") != std::string::npos)
|
||||
{
|
||||
conf.colors_enabled = v == "yes";
|
||||
|
||||
@@ -176,6 +176,7 @@ struct ncmpcpp_config
|
||||
|
||||
mpd_tag_type media_lib_primary_tag;
|
||||
|
||||
bool enable_idle_notifications;
|
||||
bool colors_enabled;
|
||||
bool fancy_scrolling;
|
||||
bool playlist_show_remaining_time;
|
||||
|
||||
Reference in New Issue
Block a user