spoon

set dwm status
git clone git://git.2f30.org/spoon.git
Log | Files | Refs | LICENSE

commit 98607302965b349b4ef377b31627dad69e3a1fe9
parent cb6af3adecc068b161a43a20103221498a228bcf
Author: lostd <lostd@2f30.org>
Date:   Wed Nov  2 18:00:37 +0100

Don't show anything when mpd is stopped

Diffstat:
mpd.c | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/mpd.c b/mpd.c @@ -18,6 +18,8 @@ int mpdread(void *arg, char *buf, size_t len) { static struct mpd_connection *conn; + struct mpd_status *status; + enum mpd_state state; struct mpd_song *song; const char *artist, *title; struct mpdarg *mpdarg = arg; @@ -30,6 +32,14 @@ mpdread(void *arg, char *buf, size_t len) if (mpd_connection_get_error(conn) != MPD_ERROR_SUCCESS) goto out; } + mpd_send_status(conn); + status = mpd_recv_status(conn); + state = mpd_status_get_state(status); + mpd_status_free(status); + if (!mpd_response_finish(conn)) + goto out; + if (state != MPD_STATE_PLAY && state != MPD_STATE_PAUSE) + return -1; mpd_send_current_song(conn); song = mpd_recv_song(conn); if (song == NULL) {