Random Album Script

Forum rules
Share your brain ;)
User avatar
Launfal
Dirty Laundry
Posts: 141
Joined: Tue Mar 04, 2014 12:50 am
Location: Ohio, USA

Random Album Script

Unread post by Launfal » Tue May 27, 2014 4:29 pm

From the "Yeah, I know you guys learned this decades ago, but I'm still new at this cool stuff" desk, here's a simple script that plays random albums stored on your hard-drives. It assumes a AlbumArtist/Album/Track hierarchy, but it does work pretty neat. My stuff's all in FLAC and OGG, so vorbistools does the job for me with ogg123.

Code: Select all

#!/bin/bash
cd [album-artist-directory]
while:
do
ogg123 $(ls -1 | shuf -n 1)
sleep 2
done
There it is, my first real bash script. ogg123 needs two Control-C's to exit, and this script adds a third, but for all that RMS-friendly music on your comp, no need to install something bloaty like GMusicbrowser for the same functionality.

For example, I've got a box set of Mozart that's 170 CD's. I put the Mozart directory in the script, and it decides which cd to play when.

Edit: clarification and correction.

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: Random Album Script

Unread post by rhowaldt » Wed May 28, 2014 8:59 am

^ nice! edited your post to add code-tags to make the code display nicely :)
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Random Album Script

Unread post by machinebacon » Wed May 28, 2014 9:51 am

Nice of you two. Reminds me a bit of pidsley's random background setter (see "Psychedelic Shitstorm")
..gnutella..

Post Reply