ncmpcpp notification thingy
songchange.sh edited
18 lines 1.0 kB view raw
1#! /usr/bin/env nix-shell 2#! nix-shell -i bash -p mpc libnotify ffmpeg 3music_dir="$HOME/music" 4previewdir="${XDG_CACHE_HOME}/music_previews" 5filename="$(mpc -h /run/user/1000/mpd_socket --format "$music_dir"/%file% current)" 6previewname="$previewdir/$(mpc -h /run/user/1000/mpd_socket --format %album% current | base64 -w 0).png" 7album="$(mpc -h /run/user/1000/mpd_socket current -f %album%)" 8if [ "$album" = "" ]; then 9 previewname="$previewdir/$(mpc -h /run/user/1000/mpd_socket --format '%artist% - %title%' current | base64 -w 0).png" 10fi 11 12[ -e "$previewname" ] || ffmpeg -y -i "$filename" -an -vf scale=500:500 "$previewname" > /dev/null 2>&1 13 14if [ "$album" = "" ]; then 15 notify-send -a MPD -r 27072 "Now Playing" "$(mpc -h /run/user/1000/mpd_socket --format '%title%\n%artist%' current)" -h "string:image-path:$previewname" 16else 17 notify-send -a MPD -r 27072 "Now Playing" "$(mpc -h /run/user/1000/mpd_socket --format '%title%\n%artist% - %album%' current)" -h "string:image-path:$previewname" 18fi