CDDB doesn't know how to retrieve the cdid and track offsets on win32.
Net::FreeDB does, but it's query methods are broken.
Combine the two and you can successfully query freedb.org.
PS: please don't respond asking me to disscuss how Net::FreeDB is broken.
use Net::FreeDB;
use CDDB;
use Data::Dumper;
use strict;
use warnings;
{
my $freedb = Net::FreeDB->new();
my $discdata = $freedb->getdiscdata(0);
### Connect to the cddbp server.
my $cddbp = CDDB->new(
Host => 'freedb.freedb.org', # default
Port => 8880, # default
Login => 'zappa', # defaults to %ENV's
Debug => 0,
) or die $!;
### Query discs based on cddbp ID and other information.
my( $cddbp_id, $track_offsets, $total_seconds ) = (
$discdata->{ID},
$discdata->{TRACKS},
$discdata->{SECONDS}
);
for my $disc ( $cddbp->get_discs($cddbp_id, $track_offsets, $total
+_seconds ) ) {
my ($genre, $cddbp_id, $title) = @$disc;
### Query disc details (usually done with get_discs() information).
my $disc_info = $cddbp->get_disc_details($genre, $cddbp_id);
print $/, Dumper($disc_info), $/;
}
}
exit();
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.