Hardware Reference
In-Depth Information
CD Data
When playing a CD, there are often two pieces of information you'd like to keep: the track name and a scan of the
cover art. The former is more readily available and incorporated into most ripping software, while the latter isn't
(although a lot of new media center-based software is including it).
What happens to determine the track names is that the start position and length of each song on the CD is
determined and used to compute a single “fingerprint” number by way of a hashing algorithm. Because every CD
in production has a different number of songs and each song has a different length, this number should be unique.
(In reality, it's almost unique because some duplicates exist, but it's close enough.) This number is then compared
against a database of known albums 7 to retrieve the list of track names, which have been entered manually by human
volunteers around the world. These track names and titles are then added to the ID tag of the MP3 or OGG file by the
ripping software for later reference.
If you are using the CD itself, as opposed to a ripped version, then this information has to be retrieved manually
each time you want to know what's playing. A part-time solution can be employed by using the cdcd package, which
allows you to retrieve the number of the disc, the name, its tracks, and their durations.
cdcd tracks
The previous example will produce output that begins like this:
Trying CDDB server http://www.freedb.org:80/cgi-bin/cddb.cgi
Connection established.
Retrieving information on 2f107813.
CDDB query error: cannot parseAlbum name:
Total tracks: 19 Disc length: 70:18
Track Length Title
-------------------------------------------------------------------------------
1: > [ 3:52.70]
2: [ 3:48.53]
3: [ 3:02.07]
4: [ 4:09.60]
5: [ 3:55.00]
Although this lets you see the current track (indicated by the >), it is no more useful than what's provided by
any other media player. However, if you've installed the abcde ripper, you will have also already (and automagically)
installed the cddb-tool components, which will perform the CD hashing function and the database queries for you.
Consequently, you can determine the disc ID, its name, and the names of each track with a small amount of script code:
ID=`cd-discid /dev/dvd`
TITLE=`cddb-tool query http://freedb.freedb.org/~cddb/cddb.cgi 6 $(app) $(host) $ID`
The app and host parameters refer to the application name and the host name of the current machine. Although
their contents are considered mandatory, they are not vital and are included only as a courtesy to the developers so
they can track which applications are using the database. The magic number 6 refers to the protocol in use. From this
string, you can extract the genre:
GENRE=`echo $TITLE | cut -d ' ' -f 2`
4HIS WASORIGINALLYSTOREDAT#$$"BUTMORERECENTLYAT&REE$"
Search WWH ::




Custom Search