MP3 Manager on NetBeans Platform

Yesterday was the first week day since I started this blog, as far as I'm aware (outside of vacations), that I didn't blog! And that's because I spent the time I normally spend blogging on extending the MP3 Manager a bit. Now multiple files can be opened (thanks to late night e-mails to and from Pierre Matthijs) and the properties display correctly (thanks to local super engineer Andrei Badea). So, from a user interface perspective, the result is currently as follows:

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.

Comments:

Hi Geertjan, 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

Posted by opsi on August 03, 2006 at 08:46 AM PDT #

Aaargh. My mistake. Sorry! I've just gone back and fixed the links in the last two blog entries, so that they now point to the correct location and use the full package name (because there seem to be several libraries called "id3lib" or "mp3"-something. At least, the package name is unique. Thanks again for pointing this out and sorry for the confusion.

Posted by Geertjan on August 03, 2006 at 09:16 AM PDT #

3rd mp3 player
http://blogs.sun.com/roller/page/lukas?entry=sources_of_mp3_player_for

Posted by Lukas on August 07, 2006 at 01:04 AM PDT #

Not a player. A manager.

Posted by Geertjan on August 07, 2006 at 01:22 AM PDT #

ok, sorry. I missed it :(

Posted by Lukas on August 07, 2006 at 05:32 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java and JavaScript technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily, mainly on topics connected to Oracle JET and NetBeans IDE.

Search


Archives
« April 2017
SunMonTueWedThuFriSat
      
1
2
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
23
24
25
26
27
28
29
30
      
Today