/mpdzen

mpd status notification using dzen2, including a tiny but functional cover art fetcher

Primary LanguageShell

mpdzen

This is just me flexing my zsh muscles a little, creating some things marginally useful in the process.

./mpc_parse

Simple parser for mpc status. Not useful on its own, this can be sourced from other scripts to get that data.

./mpdzen

This script fetches data using mpc_parse and displays it in a nice dialogue using dzen2. Note this requires a development version of dzen2, the one from debian package in particular will not suffice! The dialogue will also include a cover art image, if there is one in xpm format in ./covers/$ARTIST/$ALBUM.xpm or ~/.cache/covers/$ARTIST/$ALBUM.xmp

Have a screenshot:

Screenshot

./mpdzen_loop

Very small utility that listens for mpd events using mpc idleloop, and when a player event happens, calls mpdzen. Basically, this will show the mpdzen notification everytime a new song is played.

./cover_fetcher ARTIST ALBUM

This script will attempt to download a cover for $ALBUM by $ARTIST using curl, and convert it to a 64x64 xpm image using ImageMagick's convert. For my nicely sorted collection of data in its ARTIST/ALBUM/TITLES hierarchy, this worked very well (zsh, obviously):

p=/path/to/mp3/
for i in ${~p}/*/*(/); do
    i=${i#$p};
    ./cover_fetcher ${i%/*} ${i#*/}; 
    echo; 
done

./dzenlines

This script wraps dzen2, and will adjust the -y parameter for subsequent calls depending on the -p, -y and -h parameters, so that they don't overlap. For example, if you call three times dzenlines -y 50 -h 30 -p 3, it will move the -y further down by 34 pixels, which is the -h parameter plus a bit of padding. Once the timeout given by -p is reached, the offset is reset to zero.

Be wary of non key-value arguments for dzen (ie, -m and -u), they may confuse the script. Just put them on the tail end of the arguments and it should be fine.

The script keeps track of state for each pair of -x,-y parameters, and will move up or down the screen depending on the sign of -y.

patches

This is a quilt patches dir that can be applied to dzen2, to allow escaping of closing parantheses for ^i() syntax. This is necessary if album names contain any ), which will blow it up otherwise.