CDDB::File - Parse a CDDB/freedb data file
my $disc = CDDB::File->new("rock/f4109511"); print $disc->id, $disc->all_ids; print $disc->artist, $disc->title; print $disc->year, $disc->genre, $disc->extd; print $disc->length, $disc->track_count; print $disc->revision, $disc->submitted_via, $disc->processed_by; foreach my $track ($disc->tracks) { print $track->number, $track->title, $track->artist; print $track->length, $track->extd; }
This module provides an interface for extracting data from CDDB-format data files, as used by freedb.
It does not read data from your CD, or submit information to freedb.
my $disc = CDDB::File->new("rock/f4109511");
This will create a new object representing the data in the file name specified.
my $discid = $disc->id; my @discid = $disc->all_ids;
Due to how freedb works, one CD may have several IDs associated with it. 'id' will return the first of these (not necessarily related to the filename from which this was read), whilst 'all_ids' will return all of them.
The title and artist of this CD. For eponymous CDs these will be identical, even if the data file leaves the artist field blank.
The (4-digit) year of release.
The genre of this CD. This is the genre as stored in the data file itself, which is not related to the 11 main freedb genres.
The "extended data" for the CD. This is used for storing miscellaneous information which has no better storage place, and can be of any length.
The run time of the CD in seconds.
The number of tracks on the CD.
Each time information regarding the CD is updated this revision number is incremented. This returns the revision number of this version.
The software which submitted this information to freedb and which processed it at the other end.
foreach my $track ($disc->tracks) { print $track->number, $track->title, $track->artist; print $track->length, $track->extd; }
Returns a list of Track objects, each of which knows its number (offset from 1, although the array is offset from 0), title, length (in seconds), and may also have extended track data.
Tracks may also contain an 'artist' field. If this is not set the artist method will return the artist of the CD.
http://www.freedb.org/
If you find this module useful, or have any comments, suggestions or improvements, please let me know.
Tony Bowden, <kasei@tmtm.com>.
Copyright (C) 2001 Tony Bowden. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install CDDB::File, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CDDB::File
CPAN shell
perl -MCPAN -e shell install CDDB::File
For more information on module installation, please visit the detailed CPAN module installation guide.