notify_mpd (548B)
1 #!/bin/sh 2 # 3 # Send notifications when mpd song changes 4 5 tmp="/tmp/cover.jpg" 6 form="Artist: %artist%\nAlbum: %album%\nTitle: %title%" 7 8 rm -f $tmp 9 10 # create the notification text 11 toprint="`mpc status -f \"$form\" | head -n3 | sed \"s:&:&:g\"`" 12 artpath="/home/mjf/Music/$(dirname "$(mpc status -f '%file%' | head -n1)")/cover.jpg" 13 14 # generate the cover icon if we find one 15 if [ -f "$artpath" ]; then 16 convert -resize 84x84 "$artpath" $tmp 17 fi 18 19 # send out the notication with the cover icon and song information 20 notify-send -i "$tmp" "$toprint" 21