From ba54cf50326d5ca45c76ef4ddb7bee69ebf1ca0d Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Fri, 12 Feb 2021 00:11:27 +0100 Subject: [PATCH] feat: add album art to notifications split behaviour for "stop" to avoid shenanigans when looking for the album art --- .local/bin/player | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.local/bin/player b/.local/bin/player index e1bb1b7..bcf5b25 100755 --- a/.local/bin/player +++ b/.local/bin/player @@ -9,6 +9,14 @@ # @description : Simple wrapper to mpc, to send notifications ###################################################################### -out="$(mpc $1 | head -n2)" -dunstify -r 10010 -u "normal" MPD "$out" +if [ "$1" = "stop" ]; then + mpc $1 + dunstify -r 10010 -u "normal" "MPD" "Music stopped" +else + export MPC_FORMAT="Artist: %artist% \nTitle: %title% \nAlbum: %album%" + out="$(mpc $1 | head -n-1)" + path="$(mpc --format %file% | head -n1 | awk -F '/' '{ printf "music/%s/%s/cover.png\n", $1,$2 }')" + + dunstify -r 10010 -u "normal" -i "$HOME/$path" "MPD" "$out" +fi