An introduction

This is a semi-public place to dump text too flimsy to even become a blog post. I wouldn't recommend reading it unless you have a lot of time to waste. You'd be better off at my livejournal. I also have another blog, and write most of the French journal summaries at the Eurozine Review.

Why do I clutter up the internet with this stuff at all? Mainly because I'm trying to get into the habit of displaying as much as possible of what I'm doing in public. Also, Blogger is a decent interface for a notebook

Wednesday, May 4, 2011

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`
mp "$i"

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

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

So I end up using an array:

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

phew! that was far too much work

No comments:

Post a Comment