aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--mpd-notification.c3
-rw-r--r--mpd-notification.h3
-rw-r--r--systemd/mpd-notification.service2
4 files changed, 8 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 9332185..8d8905a 100644
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,7 @@ RM := rm
# flags
CFLAGS += -std=c11 -O2 -fPIC -Wall -Werror
CFLAGS += -liniparser
+CFLAGS += $(shell pkg-config --cflags --libs libsystemd)
CFLAGS += $(shell pkg-config --cflags --libs libmpdclient)
CFLAGS += $(shell pkg-config --cflags --libs libnotify)
LIBAV_CFLAGS := $(shell pkg-config --cflags --libs libavformat libavutil 2>/dev/null)
diff --git a/mpd-notification.c b/mpd-notification.c
index 4475b66..f37c219 100644
--- a/mpd-notification.c
+++ b/mpd-notification.c
@@ -379,6 +379,9 @@ int main(int argc, char ** argv) {
signal(SIGTERM, received_signal);
signal(SIGUSR1, received_signal);
+ /* report ready to systemd */
+ sd_notify(0, "READY=1\nSTATUS=Waiting for mpd event...");
+
while (doexit == 0 && mpd_run_idle_mask(conn, MPD_IDLE_PLAYER)) {
mpd_command_list_begin(conn, true);
mpd_send_status(conn);
diff --git a/mpd-notification.h b/mpd-notification.h
index 4cd20e5..7927a5b 100644
--- a/mpd-notification.h
+++ b/mpd-notification.h
@@ -18,6 +18,9 @@
#include <string.h>
#include <unistd.h>
+/* systemd headers */
+#include <systemd/sd-daemon.h>
+
#include <iniparser.h>
#include <libnotify/notify.h>
#include <mpd/client.h>
diff --git a/systemd/mpd-notification.service b/systemd/mpd-notification.service
index 2e907df..14be4e3 100644
--- a/systemd/mpd-notification.service
+++ b/systemd/mpd-notification.service
@@ -8,7 +8,7 @@ Description=MPD Notification
After=mpd.service network.target network-online.target
[Service]
-Type=simple
+Type=notify
ExecStart=/usr/bin/mpd-notification
[Install]