From Music Player Daemon Community Wiki
- Description: Just make sure you have agrep installed, then adapt the filepaths if necessary. This script works fine in a mpd configuration where your mpd music directory contains directories which represent an album each.
- Homepage: http://rochel.dyndns.info/play
- Maintainer(s): Jan Rochel < jan PERIOD rochel POLLIWOG stud POINT uka FULLSTOP de >
#!/bin/sh
# Needed tools: mpc, mktemp, and agrep. Set them below
MKTEMP="mktemp -t play"
MPC=mpc
AGREP=tre-agrep
# Create a temporary file
tmp=`$MKTEMP`
# Fill the temporary file with all available albums
$MPC ls | tr _ ' ' > $tmp
# Clear the current playlist
$MPC clear > /dev/null
# Extract the album(s) from the temporary file that match our query best,
# and add them to the (empty) playlist.
$AGREP -BS 9 -D 9 "`echo $@`" $tmp | $MPC add > /dev/null
# Delete the temporary file
rm $tmp
# Start playback
$MPC play > /dev/null
# Print a nice summary of the current album to the terminal
$MPC playlist | column