1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-02-05 05:28:32 +00:00

Fix $if_mpd_playing and $mpd_percent when you stop playing a song, thanks Sakari Matikka

This commit is contained in:
Nikolas Garofil 2009-11-10 13:23:00 +01:00
parent ccbaf9ea89
commit 827be3bde8

View File

@ -196,6 +196,20 @@ static void *update_mpd_thread(void *arg)
} }
mpd_info.volume = status->volume; mpd_info.volume = status->volume;
if (status->random == 0) {
mpd_info.random = "Off";
} else if (status->random == 1) {
mpd_info.random = "On";
} else {
mpd_info.random = "";
}
if (status->repeat == 0) {
mpd_info.repeat = "Off";
} else if (status->repeat == 1) {
mpd_info.repeat = "On";
} else {
mpd_info.repeat = "";
}
/* if (status->error) { /* if (status->error) {
printf("error: %s\n", status->error); printf("error: %s\n", status->error);
} */ } */
@ -216,11 +230,7 @@ static void *update_mpd_thread(void *arg)
break; break;
} }
if (status->state == MPD_STATUS_STATE_STOP) { if (status->state == MPD_STATUS_STATE_PLAY ||
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) { status->state == MPD_STATUS_STATE_PAUSE) {
mpd_info.is_playing = 1; mpd_info.is_playing = 1;
mpd_info.bitrate = status->bitRate; mpd_info.bitrate = status->bitRate;
@ -228,22 +238,10 @@ static void *update_mpd_thread(void *arg)
status->totalTime; status->totalTime;
mpd_info.elapsed = status->elapsedTime; mpd_info.elapsed = status->elapsedTime;
mpd_info.length = status->totalTime; mpd_info.length = status->totalTime;
if (status->random == 0) {
mpd_info.random = "Off";
} else if (status->random == 1) {
mpd_info.random = "On";
} else {
mpd_info.random = "";
}
if (status->repeat == 0) {
mpd_info.repeat = "Off";
} else if (status->repeat == 1) {
mpd_info.repeat = "On";
} else {
mpd_info.repeat = "";
}
} else { } else {
mpd_info.progress = 0;
mpd_info.is_playing = 0; mpd_info.is_playing = 0;
mpd_info.elapsed = 0;
} }
if (conn->error) { if (conn->error) {