diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 14 | ||||
-rw-r--r-- | config.def.h | 2 | ||||
-rw-r--r-- | mpd-notification.c | 14 | ||||
-rw-r--r-- | screenshots/sound.png | bin | 5671 -> 5672 bytes |
5 files changed, 15 insertions, 16 deletions
@@ -1,3 +1,4 @@ +.ccls* *~ *.o config.h @@ -1,7 +1,7 @@ # mpd-notification - Notify about tracks played by mpd # commands -CC := gcc +CC := /usr/bin/cc MD := markdown INSTALL := install CP := cp @@ -47,16 +47,18 @@ README.html: README.md install: install-bin install-doc install-bin: mpd-notification - $(INSTALL) -D -m0755 mpd-notification $(DESTDIR)/usr/bin/mpd-notification + $(INSTALL) -D -m0755 mpd-notification $(DESTDIR)/usr/local/bin/mpd-notification ifneq ($(CFLAGS_SYSTEMD),) $(INSTALL) -D -m0644 systemd/mpd-notification.service $(DESTDIR)/usr/lib/systemd/user/mpd-notification.service endif install-doc: README.html - $(INSTALL) -D -m0644 README.md $(DESTDIR)/usr/share/doc/mpd-notification/README.md - $(INSTALL) -D -m0644 README.html $(DESTDIR)/usr/share/doc/mpd-notification/README.html - $(INSTALL) -D -m0644 screenshots/sound.png $(DESTDIR)/usr/share/doc/mpd-notification/screenshots/sound.png - $(INSTALL) -D -m0644 screenshots/artwork.png $(DESTDIR)/usr/share/doc/mpd-notification/screenshots/artwork.png + mkdir -p -v /usr/local/share/doc/mpd-notification + mkdir -p -v /usr/local/share/doc/mpd-notification/screenshots + $(INSTALL) -D -m0644 README.md $(DESTDIR)/usr/local/share/doc/mpd-notification/README.md + $(INSTALL) -D -m0644 README.html $(DESTDIR)/usr/local/share/doc/mpd-notification/README.html + $(INSTALL) -D -m0644 screenshots/sound.png $(DESTDIR)/usr/local/share/doc/mpd-notification/screenshots/sound.png + $(INSTALL) -D -m0644 screenshots/artwork.png $(DESTDIR)/usr/local/share/doc/mpd-notification/screenshots/artwork.png clean: $(RM) -f *.o *~ README.html mpd-notification version.h diff --git a/config.def.h b/config.def.h index 33a3584..16d0cc3 100644 --- a/config.def.h +++ b/config.def.h @@ -27,7 +27,7 @@ /* strings used to display notification messages * TEXT_PLAY_* need to include one string modifier '%s' each. */ -#define TEXT_TOPIC "MPD Notification" +#define TEXT_TOPIC "MPD" #define TEXT_PLAY_PAUSE_STATE "%s " #define TEXT_PLAY_PAUSE_TITLE "<b>%s</b>" #define TEXT_PLAY_PAUSE_ARTIST "by <i>%s</i>" diff --git a/mpd-notification.c b/mpd-notification.c index dd66dab..27d61c8 100644 --- a/mpd-notification.c +++ b/mpd-notification.c @@ -81,7 +81,6 @@ GdkPixbuf * retrieve_artwork(const char * music_dir, const char * uri) { char * uri_path = NULL, * imagefile = NULL; DIR * dir; struct dirent * entry; - regex_t regex; #ifdef HAVE_LIBAV int i; @@ -160,16 +159,14 @@ image: goto fail; } - if (regcomp(®ex, REGEX_ARTWORK, REG_NOSUB + REG_ICASE) != 0) { - fprintf(stderr, "%s: Could not compile regex.\n", program); - goto fail; - } - while ((entry = readdir(dir))) { if (*entry->d_name == '.') continue; - if (regexec(®ex, entry->d_name, 0, NULL, 0) == 0) { + if (strcmp(entry->d_name, "folder.jpg") == 0 || + strcmp(entry->d_name, "folder.png") == 0 || + strcmp(entry->d_name, "cover.jpg") == 0 || + strcmp(entry->d_name, "cover.png") == 0) { if (verbose > 0) printf("%s: Found image file: %s\n", program, entry->d_name); @@ -191,7 +188,6 @@ image: } } - regfree(®ex); closedir(dir); fail: @@ -392,7 +388,7 @@ int main(int argc, char ** argv) { notify_notification_new(TEXT_TOPIC, TEXT_NONE, ICON_AUDIO_X_GENERIC, NULL); # endif notify_notification_set_category(notification, PROGNAME); - notify_notification_set_urgency(notification, NOTIFY_URGENCY_NORMAL); + notify_notification_set_urgency(notification, NOTIFY_URGENCY_LOW); notify_notification_set_timeout(notification, notification_timeout * 1000); signal(SIGHUP, received_signal); diff --git a/screenshots/sound.png b/screenshots/sound.png Binary files differindex 710c31c..b6658e8 100644 --- a/screenshots/sound.png +++ b/screenshots/sound.png |