Command-line shuffle
Being a nerd, I tend to like the command-line. When I'm working on my laptop at home, I tend to like listening to music. Before I discovered that mplayer had a really convenient shuffle idiom, I would invoke it thusly (to listen to all my Pavement tracks in shuffle mode):
export IFS=$'\n' for track in $(find /mnt/upnp/MediaTomb/Audio/Artists/Pavement -name \*.mp3 | ~/bin/shuffle.py); do mplayer $track; done
And the wee shuffle script I whipped together looks like this:
#!/usr/bin/env python # shuffle.py import sys import random args = list(sys.stdin) random.shuffle(args) sys.stdout.writelines(args)
And here's the convenient shuffle idiom that renders my arg-shuffling script somewhat useless:
find /mnt/upnp/MediaTomb/Audio/Artists/Pavement -name \*.mp3 | mplayer -playlist - -shuffle -loop 0
Trackbacks
Use this link to trackback from your own site.

Hi, Thanks for the tip. I've been using the last command line and the shuffle is working. Minor problem is that the commands listed in the man pages of mplayer don't seem to work (e.g. command to go to next track or stop track). Any idea?
Here's an example of the output I get
find [directory] -name \*.mp3 | mplayer -playlist – -shuffle -loop 0
Reading from stdin…
MPlayer SVN-r29237-4.4.1 (C) 2000-2009 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing [file] etc..
@Cecile: I have the same issues. Not sure why keyboard commands don't work in that mode. Be interested if you figure it out, though. Thanks for stopping by.