Well, I've been lazy on this blog. I'm not surprised at this, as the number of online writing assignments for school has now reached 4 blogs and 3 wiki-projects.
I enjoy working with them and reading my classmates' work, but by the end of the day I just don't care to write or read anything else.
Because of this, I've been a little bit slow on the home-brew things of late.
I have been working on a phpMyAdmin, Ruby on Rails,(maybe) CVS arrangement on my little server and it's been working out well.
However, I've done nothing beyond the basic instructions for installation on their respective websites, so there is little useful information that I can share there.
No, what I wanted to write today was this little script I have that'll create a playlist of n tracks, fill it random from the large library I have and play it for me:
for i in /media/hda3/music/*/*/*.mp3;
do
trailer[x]=$i;
let "x +=1";
done;
cmdstr="";
total = $# > 0 ? $0 : 20;
for (( j = 0 ; j <= total; j++ )) do trailer[y]="${trailer[$y]}"; cmdstr+=" ${trailer[$y]} "; cmdstr+="^~" done ; echo $cmdstr | tr -s "^~" "\n" > shuffledList
mplayer -playlist shuffledList;
Now, this thing looks hideous. I found a script while wandering around trying to do this a while ago that was marked as non-functional but the guy said he thought he was "close". I downloaded it and couldn't figure it out. Upon revisiting it this evening, I tinkered and found a sub-standard, though functional, way of fixing it. I would credit the original author, but it was on some forum somewhere and I'm afraid I do not recall where. I have altered it significantly, though, as his would use the entirety of the directory(which was unsuitable for me, as mplayer whined at me when I tried to just do
mplayer */*/*.mp3 , saying that I had too many arguments).
This looks rather had to figure out, but it essentially takes the entirety of my directory and stuffs it into an array, which it then randomly parses through and creates a big string containing all the pathnames. I could not, for the life of me, get it to output line-breaks, so I had to do this idiotic workaround where it takes the weird little string I have up there:
^~ and turns it into a linebreak with the translator. It then outputs the whole thing into a file and has mplayer play it.
I'm sure there's a more efficient way doing this, but this works and I like it.