cs::CDDB - convenience routines for working with audio CDs and the CDDB and FreeDB databases
use cs::CDDB;
An assortment of routines for doing common things with audio CDs.
The default device to query for CD information. Default: the envvar $CDDBDEVICE or /dev/cdrom
Obtain a cs::Port attached to the CDDB server at the specified host and port. If these are omitted, use the environment variable $CDDBSERVER. Returns and array of (conn,welcome) being the connection and the welcome message respectively, or an empty array on error.
Send the specified CDDB command to the server available on conn, a cs::Port typically obtained with cs::Net::TCP->new. For commands accompanied by data, the lines specified in the array upload will be sent on receipt of a suitable 32x response to the initial command. Returns an array of (code,etc,@<additional)>.
Return the pathname of the corresponding ~/.cddb cache file.
Create a new cs::CDDB object attached to the CDDB daemon at the specified host and port.
Reset()
Forget everything learnt from the device or database.
With no argument, returns the CD device for this object. With an argument, sets the device to query and calls Reset().
Stat()
Query the device for information about the CD. Returns success.
Tracks()
Return an array of track records. Returns an empty array if there are problems obtaining information.
Note that the last track is the lead-out, not audio, and that this is only the data directly determinable from the disc. For track names etcetera you should use TrackInfo().
If the track number track is supplied, return the play time of that track in seconds. Otherwise, return the total play time of the CD in seconds.
Set the CDDB disc id for this CD.
DiscId()
Return the CDDB disc id for this CD as an integer by consulting the CDDB daemon.
Query()
Match this disc against the database. Returns an array of hashrefs of the form [categ,title,discid]. Note that a single discid may match multiple database entries.
Return the xmcd database entry as an array of lines, comments included. If the caller has a cached entry in $HOME/.cddb/category/discid then the contents of that will be returned instead.
Wrapper for the Read() method which collects the specified field from the database entry as a single value (concatenating multiple lines).
Set the category of this disc.
Category()
Return the category of this disc.
DTitle()
DISCOURAGED
Return the Artist/Title field DTITLE from the CDDB record. This is a really fucking stupid idea; these should be completely separate fields but obviously the CDDB designer had no brain.
Please use the Artist() and Title() methods instead; sadly they are mere wrappers for this method but at least we can pretend the db was well designed.
Artist()
Return the disc's artist.
Title()
Return the disc's title.
NTracks()
Return the number of tracks.
TrackInfo()
Return an array of hashrefs containing track timing and names.
CDDBSERVER, the default CDDB daemon in the form host:port
CDDB_get(3), FreeDB(3), cddiscinfo(1cs), cdtoc(1cs), cdsubmit(1cs)
Cameron Simpson <cs@zip.com.au> 10sep2001