Wednesday, September 12, 2007

I did it in Java using Blinkenlight's JID3 library

(see my post below)

The python libraries didn't cut it for me so i wrote it all in java.

It's very simple, here's how it works:


for each file or subdirectory in ./ call myFn(file)

myFn(file):
for each file/folder f:
if f is a folder call myFn(f)
if its a file and an mp3:
update the ID3 tags using JID3 // there are very simple f.setArtist(), f.setTitle() APIs in there



(funny how my pseudo code looks more like python now, i think i'm falling in love with a new language... but i guess Muslim guys are allowed to be married to 4 programming languages, hyuck hyuck)

and i parameterized it so taht i could use it for other lectures... this is a very common task that i often have to do, i have like > 10GB of islamic lectures that need organizing. Until now i have been using the simple folder/subfolder/filename technique.

only problem with all this is that it's slow... i think the JID3 libraries read in the entire track as a stream -- which stinks cuz islamic lecture tracks can be like 1.5 hours long.

Here it is, and it includes the actual binary, source code, the JIDE3 library, and the Ant build.xml:

http://www.savefile.com/files/1052896

(click the orange "Download" button, it kinda looks like an Ad but it isn't)

Here's how you use it, you put Id3Tool.jar and JID3.jar in the folder where you want to modify the tagging of the MP3s. So for example i have a "suhaib webb" folder, and in it i have a "purification of the soul" folder. In the "purification of the soul" folder i have a bunch of folders representing CDs so like CD01, CD02, etc

So i would put it in the "purification of the soul" folder and run this via commandline:

java -jar Id3Tool.jar "suhaib webb" "purification of the soul"

Instead of running it via commandline you could edit the .bat file in a text editor, and that'll do the trick as well.

Oh and if it gives you a weird "incorrect version in class files" error, i think its cuz i'm using JDK 6 and compiling for the Java 5 format -- it should work, i think its a bug in the JDK 6. To fix this, either recompile using JDK5 or just get JRE 6 from java.sun.com. I ran into the same problem when working on one of our internal apps, trying to deploy onto an instance of Tomcat running on JRE 5. I use Java generics which are new to Java , and love them, so if u have like Java 1.4, it's time u upgrade :-)

0 Comments:

Post a Comment

<< Home