Proposal for "Net_CDDB"

» Metadata » Status
  • Category: Networking
  • Proposer: Keith Palmer 
  • License: BSD
» Description
PEAR package to query the ( Audio-CD database. is a free alternative to Gracenotes CD database ( which lets you retrieve the song names/artist/title for a given audio CD.

This class uses either the CDDBP protocol or CDDBP encapsulated in HTTP to query the database for information about an audio CD. To read the table-of-contents off of the audio CD, it can execute a few different binaries (if installed on the users computer) or read info. from a user-defined function. You can also calculate the discid/track offsets from the audio CD yourself and just use the class to access the FreeDB CDDB service.

The class uses a factory pattern/driver oriented architecture for CDDB protocols and for reading data from CDs, so more protocols/CD read methods can be added easily in the future.

Example usage:

$cddb = new Net_CDDB('', 'cddiscid:///dev/acd0'); // CDDB encapsulated in HTTP requests
$arr_disc_matches = $cddb->searchDatabaseForCD();

print("The following audio-CDs match the audio-CD in your CD-ROM drive: \n");
print_r($arr_disc_matches); // An array of Net_CDDB_Disc objects

print("Here is the detailed track/artist information for the first matching disc: \n");
print_r($cddb->getDetails($arr_disc_matches[0])); // Gets track names/title/artist for first Net_CDDB_Disc object

Complete source/package file:

More information about

CDDB Protocol Info.:
» Dependencies » Links
  • HTTP_Request (Optional)
  • Net_Socket (Optional)
» Timeline » Changelog
  • First Draft: 2005-11-04
  • Proposal: 2006-02-10
  • Call for Votes: 2006-04-10
  • Keith Palmer
    [2006-02-12 22:50 UTC]

    * Cleaned up isset($conn_params[]) stuff.
    * Fixed the directory structure.
    * Constants used for CDDB response codes now.
    * Fixed funky method names for some methods.
  • Keith Palmer
    [2006-03-02 00:22 UTC]

    * Fixed the directory structure (more).
    * Factory pattern used for protocols and cd readers now.
  • Keith Palmer
    [2006-04-04 13:30 UTC]

    * Factory pattern moved to main Net_CDDB class instead of seperate class. (Justin Patrin)
    * Net_CDDB::submitDisc() uses PEAR::raiseError(). (Justin Patrin)
    * Added additional unit tests.
    * Net_CDDB_Disc supports construction from an associative array. (Justin Patrin, Ian Eure)
    * Fixed some more code-style issues. (Ian Eure)
    * Fixed the NET_CDDB_READER_USERDEFINED wierdness. (Ian Eure)
    * Protocol/CD Reader drivers now use DSN strings (i.e.: cddbp:// ) instead of constants. (Ian Eure)
    * Net_CDDB::submitDisc() uses HTTP_Request instead of raw sockets.
    * Net_CDDB_Protocol_Cddbp uses Net_Socket instead of raw sockets. (Justin Patrin)
    * Net_CDDB_Protocol_Http uses HTTP_Request instead of raw sockets. (Justin Patrin)
    * Fixed disconnection issues with CDDBP protocol.
    * PEAR_Error used more often to report detailed error messages.