summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile6
-rw-r--r--config.def.h11
-rw-r--r--mpd-notification.c10
4 files changed, 19 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index c4d600f..859d77e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
*~
*.o
+config.h
mpd-notification
README.html
diff --git a/Makefile b/Makefile
index 10b49b8..571417b 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,7 @@
CC := gcc
MD := markdown
INSTALL := install
+CP := cp
RM := rm
CFLAGS += -O2 -Wall -Werror
CFLAGS += $(shell pkg-config --cflags --libs libmpdclient) \
@@ -11,10 +12,13 @@ VERSION = $(shell git describe --tags --long)
all: mpd-notification README.html
-mpd-notification: mpd-notification.c
+mpd-notification: mpd-notification.c config.h
$(CC) $(CFLAGS) -o mpd-notification mpd-notification.c \
-DVERSION="\"$(VERSION)\""
+config.h:
+ $(CP) config.def.h config.h
+
README.html: README.md
$(MD) README.md > README.html
diff --git a/config.def.h b/config.def.h
new file mode 100644
index 0000000..0047f7d
--- /dev/null
+++ b/config.def.h
@@ -0,0 +1,11 @@
+/* name of the icon used for notifications */
+#define ICON_SOUND "sound"
+
+/* strings used to display notification messages
+ * TEXT_PLAY needs to include three '%s', in order:
+ * title, artist, album */
+#define TEXT_TOPIC "MPD Notification"
+#define TEXT_PLAY "Playing <b>%s</b>\nby <i>%s</i>\nfrom <i>%s</i>"
+#define TEXT_PAUSE "Paused playback"
+#define TEXT_STOP "Stopped playback"
+#define TEXT_UNKNOWN "(unknown)"
diff --git a/mpd-notification.c b/mpd-notification.c
index 6baa627..6ce248b 100644
--- a/mpd-notification.c
+++ b/mpd-notification.c
@@ -14,6 +14,8 @@
#include <stdlib.h>
#include <string.h>
+#include "config.h"
+
#define PROGNAME "mpd-notification"
#define NOTIFICATION_TIMEOUT 10000
@@ -21,14 +23,6 @@
#define DEBUG 0
#endif
-#define ICON_SOUND "sound"
-
-#define TEXT_TOPIC "MPD Notification"
-#define TEXT_PLAY "Playing <b>%s</b>\nby <i>%s</i>\nfrom <i>%s</i>"
-#define TEXT_PAUSE "Paused playback"
-#define TEXT_STOP "Stopped playback"
-#define TEXT_UNKNOWN "(unknown)"
-
int main(int argc, char ** argv) {
char * album = NULL, * artist = NULL, * notifystr = NULL, * title = NULL;
GError * error = NULL;