I have done this in bash with something like
- Code: Select all
shuf -n25 $SONGS | $MPC -q add
I have made a little script which breaks the library into genres (based on folder structure) so you can do 100 random rock songs etc.
- Code: Select all
#!/bin/sh
IFS='
'
read -p "You must run mpc update if you want the latest changes to work - CTRL-C now and do that if you need to, otherwise hit enter" NOTHING
GENREDIR="genres"
SONGSFILE="songs.txt"
mpc listall > $SONGSFILE
if [ ! -d $GENREDIR ]; then
mkdir $GENREDIR
fi
for i in $( cat $SONGSFILE | sed 's#/.*##g' | uniq ); do
touch "$GENREDIR/$i"
done
for i in $( ls $GENREDIR | sed 's/_/ /g' ); do
sed -n "/$i//p" $SONGSFILE > "$GENREDIR/$i.1"
mpc search genre "$i" >> "$GENREDIR/$i.1"
uniq "$GENREDIR/$i.1" "$GENREDIR/$i"
done
rm $GENREDIR/*.1
exit