I'm going to restart this application from scratch because it doesn't have much of a domain model. I started developing it mostly to work with the TreeTableView, as discussed in the day before yesterday's blog entry. But, now that it's clear that it's pretty easy to get quite far with the de.ueberdosis.mp3info library, I'm going to start again and prepare the ground properly. So, consider this a prototype!
One of the strengths of the NetBeans Platform is definitely the ease with which you can integrate third party libraries (such as, in this case, the de.ueberdosis.mp3info library). There's a template that bundles such a library in two or three clicks into your application. And then you can use the library just as you would use any library provided by the JDK. Code completion and all the rest is seamlessly available for third party libraries. And, in answer to Opsi's question (in the comments at the end of the most recent blog entry) about how to use this particular library from Java, here is a basic example:
RandomAccessFile ra = null;
try {
ra = new RandomAccessFile(getCurrentFile(), "rw");
myTag = myReader.readExtendedTag(ra);
} catch (FileNotFoundException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
String Artist = myTag.getArtist();
String Album = myTag.getAlbum();
String Title = myTag.getTitle();
In fact, that's the only part of the API that I've used thus far. Look at the second line within the try block. It uses a method called readExtendedTag(RandomAccessFile). When you use that method, you can retrieve all of the following information (or a subset thereof):
The rest of the application, apart from the snippet above, is nothing more than standard JDK classes and a handful of the NetBeans APIs. Note that, for the above snippet, you'd need the following import statements:
import de.ueberdosis.mp3info.ID3Reader;
import de.ueberdosis.mp3info.ID3Tag;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
It is a pretty cool library and, once I've designed a domain model, I hope to leverage a lot more of its functionality.
In other news. Check out this great technical writing blog, by Microsoft's Harry Miller, which includes a podcast for each blog entry, with interviews and interesting food for thought on subjects such as "Author's Voice" and "Thinking Visually". Check it out and enjoy.
thanks!, now I understand why I didn't find the java bindings. Using the packages you gave I found that the lib you are using should be mp3info (but there was a link in the post to id3lib which is a C++ lib), isn't it?
Regards
http://blogs.sun.com/roller/page/lukas?entry=sources_of_mp3_player_for