Introduction
Introduction Statistics Contact Development Disclaimer Help
tDon't show anything when mpd is stopped - spoon - dwm status utility (2f30 for…
git clone git://src.adamsgaard.dk/spoon
Log
Files
Refs
LICENSE
---
commit 98607302965b349b4ef377b31627dad69e3a1fe9
parent cb6af3adecc068b161a43a20103221498a228bcf
Author: lostd <[email protected]>
Date: Wed, 2 Nov 2016 18:00:37 +0100
Don't show anything when mpd is stopped
Diffstat:
M mpd.c | 10 ++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/mpd.c b/mpd.c
t@@ -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;
t@@ -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) {
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.