diff --git a/ChangeLog b/ChangeLog index bcb44e8f..07649bdf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2009-07-18 + * Update MPD elapsed/progress when stopped + 2009-07-18 * add compilation switch --enable-xoap to be able to use www.weather.com as a source of weather data (this avoids adding diff --git a/src/mpd.c b/src/mpd.c index 50109168..c60845cc 100644 --- a/src/mpd.c +++ b/src/mpd.c @@ -197,7 +197,7 @@ static void *update_mpd_thread(void *arg) printf("error: %s\n", status->error); } */ - switch(status->state) { + switch (status->state) { case MPD_STATUS_STATE_PLAY: mpd_info.status = "Playing"; break; @@ -213,7 +213,11 @@ static void *update_mpd_thread(void *arg) break; } - if (status->state == MPD_STATUS_STATE_PLAY || + if (status->state == MPD_STATUS_STATE_STOP) { + mpd_info.progress = (float) status->elapsedTime / + status->totalTime; + mpd_info.elapsed = status->elapsedTime; + } else if (status->state == MPD_STATUS_STATE_PLAY || status->state == MPD_STATUS_STATE_PAUSE) { mpd_info.is_playing = 1; mpd_info.bitrate = status->bitRate;