playing mp3s in orer

I often use mplayer to play all files in a directory:

mp ./*

*mp*, by the way, is simply an alias for mplayer, used to play things faster and with speed control:


$ which mp
mp: aliased to mplayer -speed 1.21 -af scaletempo=speed=tempo

But what if I want to play them in date order? (useful to replay a stream with streamripper). I need a shell loop. A for loop will choke on filenames with spaces
:


$ for i in `ls -tr`
do
mp "$i"
done

A while loop seems to give me some problem of mplayer reading too much from stdin:


$ ls -1tr | while read i
do; mp '$i'
done

So I end up using an array:


$ mp3files=( ./*mp3 )
$ for d in "${mp3files[@]}"; do
mp "$d"
done

phew! that was far too much work

Leave a Reply

Your email address will not be published. Required fields are marked *