Package

~/.local/bin/mpd-coverart.sh

Rina Kawakita 2019. 12. 26. 22:28
~/.local/bin/mpd-coverart.sh
#!/bin/sh

form="\nArtist:\t%artist%\nAlbum:\t%album%\nTitle:\t%title%"

while true
do
    mpc idle player

    ##"`mpc current -f \"$form\" | sed \"s:&:&:g\"`"
    toprint="`mpc status -f \"$form\" | head -n4 | sed \"s:&:&:g\"`"
    echo $toprint

    artpath="/home/nietz/Music/$(dirname "$(mpc status -f '%file%' | head -n1)")/cover.jpg"

    rm /tmp/cover.png
    convert -resize 128x128 "$artpath" /tmp/cover.png

    notify-send -a MPD -r 1337 -i "/tmp/cover.png" "                   MPD" "$toprint"
done