djangoproject.com | python.org | nginx.org
version seven.
  http://demongin.org
demongin.org - Recursively Play MP3's with mpg321/mpg123 and find

Recursively Play MP3's with mpg321/mpg123 and find

It's really easy.


Saturday, 2011-03-12 | Music, On the Internet, Programming

RTFM, n00b.

Aristole

Sorry for the unscheduled post, but I've got to stick my head out of hiatus for a second to beat a few brows.

Long story short, I was Googling find (trying to learn how to write ballsier one-liners) a few minutes ago and stumbled unto a bunch of random threads on various, unrelated sites where people were stroking out about how mpg321 and mpg123 cannot easily play MP3 files recursively.

Basically, these chumps were doing this:

toconnell@chevette:/mnt/data/audio/Soutaiseiriron$ mpg321 * 
...and then whinging at the Internet about how much better whichever lame GUI solution works.

Here is a PSA for you people on how to do simple recursion on your filesystem and play MP3 files as you go:
toconnell@chevette:/mnt/data/audio/Soutaiseiriron$ find -name *.mp3 |mpg321 -@ -
You can also do shuffle/random by adding a majuscule or minuscule "z":
toconnell@chevette:/mnt/data/audio/Soutaiseiriron$ find -name *.mp3 |mpg321 -z -@ -
Incidentally, on most modern shells and in most contemporary Linuxes, this will auto-magically handle white space and unrecognized characters:
toconnell@chevette:/mnt/data/audio/Soutaiseiriron$ find -name *.mp3 |mpg321 -@ -
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layer 1, 2, and 3.
Version 0.2.13-1 (2010/09/20). Written and copyrights by Joe Drew,
now maintained by Nanakos Chrysostomos and others.
Uses code from various people. See 'README' for more!
THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!
tcgetattr(): Invalid argument
tcsetattr ICANON: Invalid argument
Title	: �������                        Artist : SOUTAISEIRIRON                
Album	: chiffon capitalism             Year	 : 08 M
Comment : www.j-pop.cn                   Genre : JRock                         

Directory: ././2008_シフォン主義/
Playing MPEG stream from 01 スマトラ警備隊.mp3 ...
MPEG 1.0 layer III, 192 kbit/s, 44100 Hz joint-stereo

[2:42] Decoding of 01 スマトラ警備隊.mp3 finished.
Title	: ���������                      Artist : SOUTAISEIRIRON                
Album	: chiffon capitalism             Year	 : 08 M
Comment : www.j-pop.cn                   Genre : JRock                         

Playing MPEG stream from 04 おはようオーパーツ.mp3 ...
MPEG 1.0 layer III, 192 kbit/s, 44100 Hz joint-stereo
Like, check it out computer-hacker-guy: you live on the command line now; in case you haven't figured it out yet, the whole damn thing is series of lists. Get hip to working with lists or GTFO.