diff options
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | README.md | 46 | ||||
-rw-r--r-- | config.def.h | 4 | ||||
-rw-r--r-- | mpd-notification.c | 16 | ||||
-rw-r--r-- | mpd-notification.h | 2 | ||||
-rw-r--r-- | systemd/mpd-notification.service | 2 |
6 files changed, 58 insertions, 21 deletions
@@ -25,7 +25,8 @@ LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie # this is just a fallback in case you do not use git but downloaded # a release tarball... -VERSION := 0.9.0 +DISTVER := 0.9.2 +VERSION ?= $(shell git describe --long 2>/dev/null || echo $(DISTVER)) all: mpd-notification README.html @@ -62,6 +63,6 @@ distclean: $(RM) -f *.o *~ README.html mpd-notification version.h config.h release: - git archive --format=tar.xz --prefix=mpd-notification-$(VERSION)/ $(VERSION) > mpd-notification-$(VERSION).tar.xz - gpg --armor --detach-sign --comment mpd-notification-$(VERSION).tar.xz mpd-notification-$(VERSION).tar.xz - git notes --ref=refs/notes/signatures/tar add -C $$(git archive --format=tar --prefix=mpd-notification-$(VERSION)/ $(VERSION) | gpg --armor --detach-sign --comment mpd-notification-$(VERSION).tar | git hash-object -w --stdin) $(VERSION) + git archive --format=tar.xz --prefix=mpd-notification-$(DISTVER)/ $(DISTVER) > mpd-notification-$(DISTVER).tar.xz + gpg --armor --detach-sign --comment mpd-notification-$(DISTVER).tar.xz mpd-notification-$(DISTVER).tar.xz + git notes --ref=refs/notes/signatures/tar add -C $$(git archive --format=tar --prefix=mpd-notification-$(DISTVER)/ $(DISTVER) | gpg --armor --detach-sign --comment mpd-notification-$(DISTVER).tar | git hash-object -w --stdin) $(DISTVER) @@ -1,6 +1,10 @@ mpd-notification ================ +[](https://github.com/eworm-de/mpd-notification/stargazers) +[](https://github.com/eworm-de/mpd-notification/network) +[](https://github.com/eworm-de/mpd-notification/watchers) + **Notify about tracks played by mpd** This runs in background and produces notifications whenever mpd produces @@ -15,23 +19,27 @@ This now even supports album artwork: Read below for the details. +*Use at your own risk*, pay attention to +[license and warranty](#license-and-warranty), and +[disclaimer on external links](#disclaimer-on-external-links)! + Requirements ------------ To compile and run `mpd-notification` you need: -* [systemd](https://www.github.com/systemd/systemd) -* [file](https://www.darwinsys.com/file/) for `libmagic` -* [iniparser](https://github.com/ndevilla/iniparser) -* [libav](https://libav.org/) or [ffmpeg](https://www.ffmpeg.org/) -* [libnotify](https://developer.gnome.org/notification-spec/) -* [libmpdclient](https://www.musicpd.org/libs/libmpdclient/) -* [markdown](https://daringfireball.net/projects/markdown/) (HTML documentation) +* [systemd ↗️](https://www.github.com/systemd/systemd) +* [file ↗️](https://www.darwinsys.com/file/) for `libmagic` +* [iniparser ↗️](https://github.com/ndevilla/iniparser) +* [libav ↗️](https://libav.org/) or [ffmpeg ↗️](https://www.ffmpeg.org/) +* [libnotify ↗️](https://developer.gnome.org/notification-spec/) +* [libmpdclient ↗️](https://www.musicpd.org/libs/libmpdclient/) +* [markdown ↗️](https://daringfireball.net/projects/markdown/) (HTML documentation) * `gnome-icon-theme` or `adwaita-icon-theme` (or anything else that includes an icon named `audio-x-generic`) To use `mpd-notification` you probably want `mpd`, the -[music player daemon](http://www.musicpd.org/) itself. ;) +[music player daemon ↗️](https://www.musicpd.org/) itself. ;) Some systems may require additional development packages for the libraries. Look for `libnotify-devel`, `libmpdclient-devel` or similar. @@ -41,11 +49,11 @@ Build and install Building and installing is very easy. Just run: -> make + make followed by: -> make install + make install This will place an executable at `/usr/bin/mpd-notification`, documentation can be found in `/usr/share/doc/mpd-notification/`. @@ -125,6 +133,21 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the [GNU General Public License](COPYING.md) for more details. +Disclaimer on external links +---------------------------- + +Our website contains links to the websites of third parties ("external +links"). As the content of these websites is not under our control, we +cannot assume any liability for such external content. In all cases, the +provider of information of the linked websites is liable for the content +and accuracy of the information provided. At the point in time when the +links were placed, no infringements of the law were recognisable to us. +As soon as an infringement of the law becomes known to us, we will +immediately remove the link in question. + +> 💡️ **Hint**: All external links are marked with an arrow pointing +> diagonally in an up-right (or north-east) direction (↗️). + ### Upstream URL: @@ -133,3 +156,6 @@ URL: Mirror: [eworm.de](https://git.eworm.de/cgit.cgi/mpd-notification/) [GitLab.com](https://gitlab.com/eworm-de/mpd-notification#mpd-notification) + +--- +[⬆️ Go back to top](#top) diff --git a/config.def.h b/config.def.h index b8ef018..e7a1264 100644 --- a/config.def.h +++ b/config.def.h @@ -1,5 +1,5 @@ /* - * (C) 2011-2024 by Christian Hesse <mail@eworm.de> + * (C) 2011-2025 by Christian Hesse <mail@eworm.de> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ /* this is a regular expression that has to match image filename used * for artwork */ -#define REGEX_ARTWORK "\\(folder\\|cover\\)\\.\\(jpg\\|png\\)" +#define REGEX_ARTWORK "\\(folder\\|cover\\)\\.\\(avif\\|jpg\\|png\\|webp\\)" /* how to connect to mpd host ? * MPD_HOST is the server's host name, IP address or Unix socket path. If the diff --git a/mpd-notification.c b/mpd-notification.c index af8985a..c48979e 100644 --- a/mpd-notification.c +++ b/mpd-notification.c @@ -1,5 +1,5 @@ /* - * (C) 2011-2024 by Christian Hesse <mail@eworm.de> + * (C) 2011-2025 by Christian Hesse <mail@eworm.de> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -85,7 +85,7 @@ GdkPixbuf * retrieve_artwork(const char * music_dir, const char * uri) { int i; const char *magic_mime; AVFormatContext * pFormatCtx = NULL; - GdkPixbufLoader * loader; + GdkPixbufLoader * loader = NULL; /* try album artwork first */ if ((uri_path = malloc(strlen(music_dir) + strlen(uri) + 2)) == NULL) { @@ -134,13 +134,21 @@ GdkPixbuf * retrieve_artwork(const char * music_dir, const char * uri) { fprintf(stderr, "%s: gdk_pixbuf_loader_write() failed parsing buffer.\n", program); goto image; } + + if (gdk_pixbuf_loader_close(loader, NULL) == FALSE) { + fprintf(stderr, "%s: gdk_pixbuf_loader_close() failed.\n", program); + goto image; + } if ((pixbuf = gdk_pixbuf_loader_get_pixbuf(loader)) == NULL) { fprintf(stderr, "%s: gdk_pixbuf_loader_get_pixbuf() failed creating pixbuf.\n", program); goto image; } - gdk_pixbuf_loader_close(loader, NULL); + g_object_ref(pixbuf); + g_object_unref(loader); + loader = NULL; + goto done; } } @@ -149,6 +157,8 @@ GdkPixbuf * retrieve_artwork(const char * music_dir, const char * uri) { printf("%s: No artwork in media file.\n", program); image: + if (loader) + g_object_unref(loader); #endif /* cut the file name from path for current directory */ diff --git a/mpd-notification.h b/mpd-notification.h index d11e822..3e7254f 100644 --- a/mpd-notification.h +++ b/mpd-notification.h @@ -1,5 +1,5 @@ /* - * (C) 2011-2024 by Christian Hesse <mail@eworm.de> + * (C) 2011-2025 by Christian Hesse <mail@eworm.de> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/systemd/mpd-notification.service b/systemd/mpd-notification.service index 61b8f66..6a75da1 100644 --- a/systemd/mpd-notification.service +++ b/systemd/mpd-notification.service @@ -1,4 +1,4 @@ -# (C) 2011-2024 by Christian Hesse <mail@eworm.de> +# (C) 2011-2025 by Christian Hesse <mail@eworm.de> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by |