Friday Jan 21, 2005

I need to be able to read all the varous flavors of MP3 ID3 tags from Java. I took a tour through a number of different java mp3 tagging packages (see id3 java mp3 google search. Some were slow, some were way to complex, but Jens Vonderheide's java_mp3 was just right. It's fast, small, and easy to use. Here's a code snippet that dumps artist album and title of a song:


import de.vdheide.mp3.*;

    public  void showID3(File file) {
        try {
            ID3 id3 = new ID3(file);
            System.out.println("Artist: " + id3.getArtist());
            System.out.println("Album: " + id3.getAlbum());
            System.out.println("Title: " + id3.getTitle());));
        } catch (NoID3TagException e) {
            System.err.println("no ID3 Info found for " + file);
        }
    }

This blog copyright 2009 by plamere