| 1 |
NAME |
| 2 |
CDDB::File - Parse a CDDB/freedb data file |
| 3 |
|
| 4 |
SYNOPSIS |
| 5 |
my $disc = CDDB::File->new("rock/f4109511"); |
| 6 |
|
| 7 |
print $disc->id, $disc->all_ids; |
| 8 |
print $disc->artist, $disc->title; |
| 9 |
print $disc->year, $disc->genre, $disc->extd; |
| 10 |
print $disc->length, $disc->track_count; |
| 11 |
|
| 12 |
print $disc->revision, $disc->submitted_via, $disc->processed_by; |
| 13 |
|
| 14 |
foreach my $track ($disc->tracks) { |
| 15 |
print $track->number, $track->title, $track->artist; |
| 16 |
print $track->length, $track->extd; |
| 17 |
} |
| 18 |
|
| 19 |
DESCRIPTION |
| 20 |
This module provides an interface for extracting data from CDDB-format |
| 21 |
data files, as used by freedb. |
| 22 |
|
| 23 |
It does not read data from your CD, or submit information to freedb. |
| 24 |
|
| 25 |
METHODS |
| 26 |
new |
| 27 |
my $disc = CDDB::File->new("rock/f4109511"); |
| 28 |
|
| 29 |
This will create a new object representing the data in the file name |
| 30 |
specified. |
| 31 |
|
| 32 |
id / all_ids |
| 33 |
my $discid = $disc->id; |
| 34 |
my @discid = $disc->all_ids; |
| 35 |
|
| 36 |
Due to how freedb works, one CD may have several IDs associated with it. |
| 37 |
'id' will return the first of these (not necessarily related to the |
| 38 |
filename from which this was read), whilst 'all_ids' will return all of |
| 39 |
them. |
| 40 |
|
| 41 |
title / artist |
| 42 |
The title and artist of this CD. For eponymous CDs these will be |
| 43 |
identical, even if the data file leaves the artist field blank. |
| 44 |
|
| 45 |
year |
| 46 |
The (4-digit) year of release. |
| 47 |
|
| 48 |
genre |
| 49 |
The genre of this CD. This is the genre as stored in the data file |
| 50 |
itself, which is not related to the 11 main freedb genres. |
| 51 |
|
| 52 |
extd |
| 53 |
The "extended data" for the CD. This is used for storing miscellaneous |
| 54 |
information which has no better storage place, and can be of any length. |
| 55 |
|
| 56 |
length |
| 57 |
The run time of the CD in seconds. |
| 58 |
|
| 59 |
track_count |
| 60 |
The number of tracks on the CD. |
| 61 |
|
| 62 |
revision |
| 63 |
Each time information regarding the CD is updated this revision number |
| 64 |
is incremented. This returns the revision number of this version. |
| 65 |
|
| 66 |
processed_by / submitted_via |
| 67 |
The software which submitted this information to freedb and which |
| 68 |
processed it at the other end. |
| 69 |
|
| 70 |
tracks |
| 71 |
foreach my $track ($disc->tracks) { |
| 72 |
print $track->number, $track->title, $track->artist; |
| 73 |
print $track->length, $track->extd; |
| 74 |
} |
| 75 |
|
| 76 |
Returns a list of Track objects, each of which knows its number |
| 77 |
(numering from 1), title, length (in seconds), offset, and may also have |
| 78 |
extended track data. |
| 79 |
|
| 80 |
Tracks may also contain an 'artist' field. If this is not set the artist |
| 81 |
method will return the artist of the CD. |
| 82 |
|
| 83 |
SEE ALSO |
| 84 |
http://www.freedb.org/ |
| 85 |
|
| 86 |
AUTHOR |
| 87 |
Tony Bowden |
| 88 |
|
| 89 |
BUGS and QUERIES |
| 90 |
Please direct all correspondence regarding this module to: |
| 91 |
[email protected] |
| 92 |
|
| 93 |
COPYRIGHT |
| 94 |
Copyright (C) 2001-2005 Tony Bowden. All rights reserved. |
| 95 |
|
| 96 |
This program is free software; you can redistribute it and/or modify it under |
| 97 |
the terms of the GNU General Public License; either version 2 of the License, |
| 98 |
or (at your option) any later version. |
| 99 |
|
| 100 |
This program is distributed in the hope that it will be useful, but WITHOUT |
| 101 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 102 |
FOR A PARTICULAR PURPOSE. |
| 103 |
|