Monday, July 2, 2012

Play all mp3s in subtrees

~/bin/playall:
 
#!/bin/bash
find . -iname '*.mp3' | sort | awk '{ print "\""$0"\"" }' | xargs mplayer

Good for playing all albums of an artist.

But wait! This doesn't give mplayer focus, so you can't press spacebar to pause/unpause. That's extremely annoying. We can fix that by replacing mplayer with mplayer_wrapper:

#!/bin/bash
mplayer "$@" < /dev/tty