CDDB::File(3pm)
πΏ CDDB::File β the perl manual, but make it cute
okay bestie, gather round, because we're talking about CDDB::File, a lil Perl module from the User Contributed Perl Documentation shelf that parses CDDB/freedb data files for you. no cap, it's iconic. π
β¨ NAME β¨
CDDB::File β it parses a CDDB/freedb data file. that's the whole job. she does it flawlessly. π
πΈ SYNOPSIS πΈ
here's the vibe, literally the whole thing in one glance:
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;
}
like?? she's giving everything and asking for nothing. π₯
π¦ DESCRIPTION π¦
so this module is your little interface for extracting data from CDDB-format data files, the kind that freedb uses. it's a parser. it's a whole mood.
π¨ okay important, bestie: this module does NOT read data from your CD. it also does NOT submit information to freedb. it only reads the files. that's it. that's the boundary. respect it. π
π METHODS π
π new
my $disc = CDDB::File->new("rock/f4109511");
this creates a brand new object representing the data in the file name you specified. it's giving birth to a disc object. main character energy fr fr. β¨
π« id / all_ids
my $discid = $disc->id;
my @discid = $disc->all_ids;
so here's the tea: because of how freedb works, one CD may have several IDs associated with it. the way that happens is just freedb being freedb.
idreturns the first of these IDs β and ngl, that first one is not necessarily related to the filename you read it from. plot twist.all_idsreturns all of them. the whole squad. π
π title / artist
the title and artist of this CD. and listen β for eponymous CDs these will be identical, even if the data file leaves the artist field blank. she fills in the gaps for you. so thoughtful. π«Ά
β year
the (4-digit) year of release. four digits. count 'em. π
π§ genre
the genre of this CD. and lowkey, this is the genre as stored in the data file itself β which is not related to the 11 main freedb genres. so don't come for her about genre accuracy, she's just reporting what's in the file. π
π extd
the "extended data" for the CD. this is where all the miscellaneous information lives that has no better storage place. and it can be of any length. any length bestie. go wild. β¨
πΈ length
the run time of the CD, in seconds. β±οΈ
π
track_count
the number of tracks on the CD. simple. clean. iconic. π
π₯ revision
each time information regarding the CD is updated, this revision number gets incremented. this returns the revision number of this version. so like, version history but make it a number. π
π processed_by / submitted_via
the software which submitted this information to freedb, and the software which processed it at the other end. two ends of the pipeline, both accounted for. π€
π tracks
foreach my $track ($disc->tracks) {
print $track->number, $track->title, $track->artist;
print $track->length, $track->extd;
}
returns a list of Track objects, and each one knows:
- its number (numbering from 1)
- its title
- its length (in seconds)
- its offset
- and it may also have extended track data
and psst β tracks may also contain an artist field. but if that's not set, the artist method will just return the artist of the CD. she's got you covered either way. no track left behind. π
π SEE ALSO π
go say hi to freedb, she's the source of all this. π
π«Ά AUTHOR π«Ά
Tony Bowden
π BUGS and QUERIES π
please direct all correspondence regarding this module to:
bug-CDDB-File@rt.cpan.org
that's the address. that's where the feelings go. π
π COPYRIGHT π
Copyright (C) 2001-2005 Tony Bowden. All rights reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License; either version 2 of the License,
or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.
π bestie please read that middle bit β WITHOUT ANY WARRANTY β no implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. she said what she said. it's GPL, version 2 or later, your choice. π
and that's the whole page, bestie!! this lil drop was brought to you by perl v5.36.0, dated 2022-11-21, and it's filed under CDDB::File(3pm) in the User Contributed Perl Documentation. now go parse some discs. slay. β¨πΏπ
π¦ where this page comes from
- debian bookworm: libcddb-file-perl 1.05-3 Β· GPL-2.0-or-later
- debian trixie: libcddb-file-perl 1.05-3 Β· GPL-2.0-or-later
- ubuntu noble: libcddb-file-perl 1.05-3 Β· GPL-2.0-or-later
- ubuntu resolute: libcddb-file-perl 1.05-3 Β· GPL-2.0-or-later
- ubuntu stonking: libcddb-file-perl 1.05-3 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms