In spite of its simplicity, this is by far the most useful thing I have ever written. It was particularly so when I had 20+ GB of music prior to a Maxtor SATA drive crash. I am hoping someone else can take some use out of it, and possibly offer improvements; as will soon be apparent, I am not that great at scripting. It runs the same search three times for three different reasons (did not know of a more efficient way to do it), so if you do have a good deal of music, it might take a couple of seconds the first time it runs, but should be nearly instantaneous after the search is in RAM.
You just invoke the script with one or two strings, it searches your music collection, displays a list of matches, and prompts if you wish to add them to your active playlist.
Code:
#!/bin/bash
export MUSIC_DIR=~/music
yorn()
{
echo -n " [y/n] "
read YN junk
if [ "$YN" = "y" ]
then
return 0;
else
return -1;
fi
}
echo
find $MUSIC_DIR | grep -i "$1" | grep -i "$2" | grep mp3
echo; echo -n "Enqueue these "; find $MUSIC_DIR | grep -i "$1" | grep -i "$2" | grep mp3 | wc -l; echo "songs?"; echo
if yorn; then
find $MUSIC_DIR -printf "xmms -e "\"%p\"' ''\\ \n' | grep mp3 | grep -i "$1" | grep -i "$2" | /bin/bash
# xmms -p
fi