diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | config.def.h | 11 | ||||
-rw-r--r-- | mpd-notification.c | 10 |
4 files changed, 19 insertions, 9 deletions
@@ -1,4 +1,5 @@ *~ *.o +config.h mpd-notification README.html @@ -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; |