Something went wrong. Try again.
ncmpcpp notification thingy
Something went wrong. Try again.
1.0 kB · 18 lines · Created 11mo ago
Shell
12345678910111213141516171819#! /usr/bin/env nix-shell#! nix-shell -i bash -p mpc libnotify ffmpegmusic_dir="$HOME/music"previewdir="${XDG_CACHE_HOME}/music_previews"filename="$(mpc -h /run/user/1000/mpd_socket --format "$music_dir"/%file% current)"previewname="$previewdir/$(mpc -h /run/user/1000/mpd_socket --format %album% current | base64 -w 0).png"album="$(mpc -h /run/user/1000/mpd_socket current -f %album%)"if [ "$album" = "" ]; then previewname="$previewdir/$(mpc -h /run/user/1000/mpd_socket --format '%artist% - %title%' current | base64 -w 0).png"fi
[ -e "$previewname" ] || ffmpeg -y -i "$filename" -an -vf scale=500:500 "$previewname" > /dev/null 2>&1
if [ "$album" = "" ]; then 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"else 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"fi