Introduction
Introduction Statistics Contact Development Disclaimer Help
tAllow selecting the host/port for the mpd plugin - spoon - dwm status utility …
git clone git://src.adamsgaard.dk/spoon
Log
Files
Refs
LICENSE
---
commit 36856fa7ba39356dcf456226797ff588a5733999
parent 474e42ea9414fa2cd257f8c5e3f75905d684d527
Author: sin <[email protected]>
Date: Mon, 17 Oct 2016 17:09:27 +0100
Allow selecting the host/port for the mpd plugin
Diffstat:
M Makefile | 2 +-
M config.def.h | 2 +-
M mpd.c | 4 +++-
M spoon.c | 1 +
A types.h | 4 ++++
5 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/Makefile b/Makefile
t@@ -5,7 +5,7 @@ SRC = spoon.c batt.c wifi.c cpu.c temp.c mix.c date.c load.c\
OBJ = spoon.o batt.o wifi.o cpu.o temp.o mix.o date.o load.o\
strlcpy.o strlcat.o stub.o
BIN = spoon
-DISTFILES = $(SRC) util.h config.def.h Makefile LICENSE configure
+DISTFILES = $(SRC) types.h util.h config.def.h Makefile LICENSE configure
include config.mk
diff --git a/config.def.h b/config.def.h
t@@ -3,7 +3,7 @@ int delay = 1;
struct ent ents[] = {
/* reorder/remove these as you see fit */
- { .fmt = "[%s] ", .read = mpdread, .arg = NULL },
+ { .fmt = "[%s] ", .read = mpdread, .arg = &(struct mpdar…
{ .fmt = "[%s] ", .read = mixread, .arg = NULL },
{ .fmt = "[%s] ", .read = loadread, .arg = NULL },
{ .fmt = "[%s] ", .read = cpuread, .arg = NULL },
diff --git a/mpd.c b/mpd.c
t@@ -3,6 +3,7 @@
#include <mpd/client.h>
+#include "types.h"
#include "util.h"
int
t@@ -11,9 +12,10 @@ mpdread(void *arg, char *buf, size_t len)
static struct mpd_connection *conn;
struct mpd_song *song;
const char *artist, *title, *name;
+ struct mpdarg *mpdarg = arg;
if (conn == NULL) {
- conn = mpd_connection_new(NULL, 0, 0);
+ conn = mpd_connection_new(mpdarg->host, mpdarg->port, 0);
if (conn == NULL)
return -1;
if (mpd_connection_get_error(conn) != MPD_ERROR_SUCCESS)
diff --git a/spoon.c b/spoon.c
t@@ -24,6 +24,7 @@ struct ent {
void *arg;
};
+#include "types.h"
#include "config.h"
int
diff --git a/types.h b/types.h
t@@ -0,0 +1,4 @@
+struct mpdarg {
+ char *host;
+ unsigned int port;
+};
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.