Thu November 20th 2008 11:38 am Blog | Gallery | Geek | Travels | Home | Contact | Archives | Links
Tux
Blog Gallery Geek Travels Home Contact Archives Links
MP3 Playlist Generator
MySQL: Get Next Auto_increment
PHP Fortune
Recurses! Foiled again....
Kernel Watch
Get yer PHP Referrers here

Geek : MP3 Playlist Generator

MP3 Playlist Generator
Friday February 20th, 2004

I am a music nut. I'm always checking out all kinds of music. I have a very large collection of MP3 files, and it grows all the time. Rather than sifting through the list and loading one song at a time, I like to play the whole list on shuffle. But I find with a lot of software MP3 players, to load a whole directory is cumbersome and the random function seems to favor a handful of selections and play them over and over. So rather than playing a directory, I am in the habit of loading a playlist that contains every song in my collection. This works well, but it got to be annoying and time consuming adding new songs to the list all the time. So, using the Perl File::Find function demonstrated in this entry, I wrote a script that generates a playlist automatically. It searches my MP3 directory recursively and adds to the list all files ending in ".mp3".

The script takes one argument: the directory where your MP3 files are stored. To run it, call your perl executable as usual followed by the script name (let's call it playlist_gen.pl) followed by the MP3 directory:

$ perl playlist_gen.pl /home/username/mp3

This script is written for a UNIX-like machine but Perl can be installed on Windows too -- just change your slashes to double-backslashes. It should also be pointed out that the generated file is given an ".m3u" extension, which is what WinAmp uses. I would guess the file can be used by most any player, but the extension may need to be changed.

Posted by Jamie
Comments: 3
Previous Entry

Comments: (3)

can his script be changed and made so it can detect a text file and either just shuffle the text file or detect files in folder and make a new .txt file with list please repond im learning to script and im little stumped p.s. im on a windows system ty in advanced

Posted by michael on 9/1/05 at 9:05 AM EST

ok

Posted by arwin on 2/8/06 at 6:06 AM EST

wala

Posted by juztin lee on 4/23/07 at 10:27 AM EST


Your 2¢ (comments subject to approval)
The Captcha image Phonetic spelling (mp3)
© 2003 Jamie Doris Blog | Gallery | Geek | Travels | Home | Contact | Archives | Links