For Programmers: Free Programming Magazines  


Home > Archive > PERL Modules > June 2006 > FreeDB lookup error with Audio::CD









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author FreeDB lookup error with Audio::CD
Angus

2006-06-24, 6:57 pm

When I do a $cddb->lookup() twice in a row for the same disk, the
second lookup fails.

Short demo:

#!/usr/bin/perl -w

use strict;
use Audio::CD;

sub run_test {
my $device = shift;
my ($cd, $cddb, $data, $info, $cddb_t, $info_t, $i);

print "==== testing $device ", "="x40, "\n";
$cd = Audio::CD->init( $device );
$cddb = $cd->cddb();
$data = $cddb->lookup();
$info = $cd->stat();
$cddb_t = $data->tracks( $info );
$info_t = $info->tracks();

printf "Disk ID = %08x\n", $cddb->discid();
printf "Artist = %s\n", $data->artist();
printf "Album = %s\n", $data->title();
printf "Genre = %s\n", $data->genre();
printf "Tracks = %d\n", $info->total_tracks();
printf "Time = %2d:%02d\n", $info->time();
printf "Length = %2d:%02d\n", $info->length();
for ($i=0; $i<=$#{$cddb_t}; $i++) {
printf "%2d:%02d . %2d:%02d %s\n",
${$info_t}[$i]->pos(),
${$info_t}[$i]->length(),
${$cddb_t}[$i]->name();
}
}

run_test( '/dev/cdrom' );
run_test( '/dev/cdrom' );

The second call to run_test() produces blank data from the lookup().
It seems as though the module calls cddb_generate_unknown_entry() for
some reason. Am I failing to reset the module somehow? I'd really
like a work-around for this problem. Anyone have any suggestions?

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com