FreeDB lookup error with Audio::CD
am 23.06.2006 14:58:57 von angusWhen 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?