Copyright © 2006-2018 MultiMedia Soft

How to get Audio CD info using CDDB servers and Amazon catalogue

Previous pageReturn to chapter overviewNext page

There are two ways to obtain information about an Audio CD:

 

If a CD audio is physically available inside the CD drive: through CDDB queries to FreeDb servers distributed around the world.

 

CDDB (which stands for Compact Disc Database) is a database for software applications to look up CD information over the Internet. This is performed by a client which calculates a (nearly) unique disc ID and then queries the database. As a result, the client is able to display the artist name, CD title, track list and some additional information.

Active Sound Recorder comes with a number of methods and properties that help the developer in getting this information from FreeDb servers: the USA server (us.freedb.org) reports that, as of January 2006, the database holds over 1,927,000 CD titles.

 

The first needed task, in order to retrieve CDDB information about an audio CD, is to verify the availability of an open Internet connection and then to request the list of available FreeDb servers: this operation is performed through a call to the CddbRequestServersList method: due to the fact that retrieving information from the Internet can be a lengthy operation, this call will return immediately and, when the list of servers will be available, a CddbServersListAvailable event will be raised: at this point it will be possible requesting each CDDB server's friendly name using the CddbGetServerName method. Note that if the target PC is running behind a proxy, you have the possibility to set the proxy details through the CddbSetProxyDetails method.

 

The second needed task is to have an audio CD inserted inside a CD drive on the target machine: this will allow calling the CddbRequestAlbumInfo method that, after calculating the audio CD's Unique Identification Number, will send a request to the FreeDb server of choice: also in this case, retrieving information from the Internet can be a lengthy operation, so this call will return immediately; when the CD album information will be available, a CddbAlbumInfoAvailable event will be raised: at this point it will be possible requesting specific album information through the CddbGetAlbumInfo method, enumerating CD tracks calling the GetCdNumTracks method and obtain the title of each single track through the CddbGetTrackTitle method.

 

When CD album information are requested and obtained through a call to the CddbRequestAlbumInfo method, the control automatically performs a search of the same Audio CD on the Amazon catalogue, through standard Amazon Web Services, in order to obtain cover pictures (also know as CD cover art) of the Audio CD: these pictures are usually of three different sizes: Small (thumbnail), Medium and Large. When this information is found, the control notifies the container application about their availability through the following events:

 

CdCoverURLsAvailableEx: notifies that the URL pointing to a certain CD cover picture on the Amazon catalogue is available and can be obtained through a call to the GetCdCoverPictureURL method. It's important to note that if one of these pictures should be missing on the Amazon web server, a valid URL will be in any case returned.

CdCoverPictureFileAvailableEx: notifies that the a certain CD cover picture has been downloaded from the the Amazon web site and is now available locally: the local absolute pathname of the picture can at this point be obtained through a call to the GetCdCoverPictureFile method. It's important to note that the downloaded picture files are temporarily stored inside the system defined "Temp" directory and are automatically deleted when the container application is closed.

 

 

If a CD audio is NOT physically available inside the CD drive: searching the Amazon catalogue through Amazon Web Services.

 

Differently from the method described above, where the artist name and the album title are obtained through a FreeDB server, the control can search information about an Audio CD inside the Amazon catalogue through the CdRequestAlbumInfo method: when requested information become available, the control generates the following sequence of events:

 

CddbAlbumInfoAvailable: notifies that information about the album is available and can be retrieved through the CddbGetAlbumInfo method; at the same time also the number of tracks and respective titles are retrieved and can be enumerated calling the GetCdNumTracks method (passing -1 to its nCdDriveIndex parameter) in conjunction with the CddbGetTrackTitle method.

CdCoverURLsAvailableEx: notifies that the URL pointing to a certain CD cover picture on the Amazon catalogue is available and can be obtained through a call to the GetCdCoverPictureURL method. It's important to note that if one of these pictures should be missing on the Amazon web server, a valid URL will be in any case returned.

CdCoverPictureFileAvailableEx: notifies that the a certain CD cover picture has been downloaded from the the Amazon catalogue and is now available locally: the local absolute pathname of the picture can at this point be obtained through a call to the GetCdCoverPictureFile method. It's important to note that the downloaded picture files are temporarily stored inside the system defined "Temp" directory and are automatically deleted when the container application is closed.