From 0fdc462debade7b7a4e2ae1031172a870fb833b6 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 4 Oct 2009 18:24:00 +0200 Subject: [PATCH] main: don't call mpdclient_update() for clock update When the "update timer" is running because the clock is enabled, don't call mpdclient_update() in each tick. For the clock, it's enough to update MPD only when an idle event occurs. While MPD is playing, we still need MPD updates, beacuse we need the new "elapsed" time. --- src/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 2bc1b62..34fa355 100644 --- a/src/main.c +++ b/src/main.c @@ -213,7 +213,10 @@ check_reconnect(void); static void do_mpd_update(void) { - if (mpdclient_is_connected(mpd)) + if (mpdclient_is_connected(mpd) && + (mpd->source == NULL || mpd->events != 0 || + (mpd->status != NULL && + mpd_status_get_state(mpd->status) == MPD_STATE_PLAY))) mpdclient_update(mpd); #ifndef NCMPC_MINI -- 2.30.2