9.1 CDDB

 < Day Day Up > 

Audio CDs, surprisingly, contain no information about the music on the CD. A medium that affords over 600 MB of disk space, oddly, can't find the room to store even a small bit of text describing the artist, the names of the tracks, copyright information nothing. A few modern CDs are specially crafted to make them hard to rip or contain extra bonus media, but you won't find anything about the audio contents.

To resolve this problem, most popular audio CD conversion applications calculate a fingerprint for the audio CD, connecting via the Internet to retrieve the audio CD artist, album, and track listing information from a server. The server maintains a set of fingerprints and information in a database. Unfortunately, computing the audio CD fingerprint requires lower-level access to the CD drive than is afforded by Java, so a native extension is required to compute the fingerprint.

The original system for storing audio CD track and listing information was simply called CDDB, short for CD database. Eventually, the servers and system were organized as a commercial entity, which renamed itself Gracenote (http://www.gracenote.com/). Gracenote renamed the original protocol CDDB1 and deprecated it in favor of a new, proprietary protocol, CDDB2. Commercial developers who wish to use the Gracenote CDDB system are required to purchase a license from Gracenote.

An open source project, freedb (http://www.freedb.org/), based on the original CDDB1 protocol, offers similar services to those offered by Gracenote without a fee.

Here, because it's the most accessible and flexible format, you'll create an application that uses the freedb.org database and the CDDB1 protocol to retrieve data. The CDDB1 protocol, as described at:

http://www.freedb.org/modules.php?name=Sections&sop=viewarticle&artid=28

is a throwback to classic Internet protocols. It's based on exchanging very specialized, specific text commands back and forth. Instead of XML, it's based on exchanging text strings and integer error codes.

Fortunately, our application is rescued from the gory details of the handling of the CDDB1 protocol, because it uses an existing (GPL) library provided by Holger Antelmann at http://www.antelmann.com/developer/. You'll want to download both the antelmann.jar file and the supporting CDDriveWin.dll file from:

http://www.antelmann.com/developer/downloads.htm

The antelmann.jar file should be placed in your class path, and the CDDriveWin.dll must go in the system search path for loading DLLs (e.g., on Windows XP, a reasonable place is your C:\WINDOWS directory).

If you are interested in supporting additional, non-Windows operating systems, the source uses a simple JNI hook for the library. You will need to consult the documentation for your operating system and also build a native JNI library binding to the CD drive interface. For more information, see:

  • http://www.antelmann.com/developer/javadoc/com/antelmann/cddb/CDDriveSample.html

  • http://www.antelmann.com/developer/javadoc/com/antelmann/cddb/CDDrive.html


     < Day Day Up > 


    Real World Web Services
    Real World Web Services
    ISBN: 059600642X
    EAN: 2147483647
    Year: 2006
    Pages: 83
    Authors: Will Iverson

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net