micro mpd-client :)
April 20, 2009
I am using MPD to play my small collection of mp3:
[eugeni@eugeni 16:53:31 ~] $ mpc stats
Artists: 787
Albums: 747
Songs: 9112
Everything is controlled by keybinding – for example, to run the play command, I press < Super >+Up; to run next command I press < Super >+Right, and so on. These shortcuts start a small client to mpd, which is nothing more than a shell script which:
- Starts MPD if it is not running (I do not start it on startup to save a few seconds of boot time)
- Runs mpdscribble in background to update the LAST.FM statistics
- Runs all required MPD commands
- And displays the results in a nice way
And it is multi-distro-oriented by the way
.
#!/bin/bash
# Is mpd running
mpc status 2> /dev/null
ret=$?
if [ ! "$ret" = "0" ]; then
notify-send -i audio "Music" "Starting mpd.."
# are we on arch linux?
if [ -x "/etc/rc.d/mpd" ]; then
sudo /etc/rc.d/mpd start
else
sudo su -c "service mpd start"
fi
# starting mpdscribble
mpdscribble
# starting sonata
sonata --hidden
fi
mpc $*
# Some black magick to get a bit more advanced mpd status
# and convert it to shell variables
eval `echo -e 'status\ncurrentsong\nclose\n' | \
nc localhost 6600 | \
sed -e '/OK/d' -e 's/: \(.*\)/="\1"/g'`
# show the results
notify-send -i audio "$Artist - $Album - $Title" \
"$(mpc status | sed -e 's/&/and/g')"
Just yet one another script which contributes to world’s entropy
.









