从音频 CD 获取 cd-title 和 cd-track-names 的最佳方法是什么?我试过这个模块,但没有用。
#!/usr/bin/env perl
use warnings;
use strict;
use CDDB_get qw( get_cddb );
my %config;
$config{CDDB_HOST} = "freedb.freedb.org";
$config{CDDB_PORT} = 8880;
$config{CDDB_MODE} = "cddb";
$config{CD_DEVICE} = "/dev/sr1";
# user interaction welcome?
$config{input} = 1;
my %cd = get_cddb( \%config ); # line 16
print "$_ : $cd{$_}\n" for keys %cd;
unless( defined $cd{title} ) {
die "no cddb entry found";
}
print "artist: $cd{artist}\n";
print "title: $cd{title}\n";
print "category: $cd{cat}\n";
print "cddbid: $cd{id}\n";
print "trackno: $cd{tno}\n";
my $n = 1;
for my $i ( @{$cd{track}} ) {
print "track $n: $i\n";
$n++;
}
# OUT:
# Odd number of elements in hash assignment at ./cddb_get.pl line 16.
# Use of uninitialized value in list assignment at ./cddb_get.pl line 16.
# Use of uninitialized value in concatenation (.) or string at ./cddb_get.pl line 18.
# :
# no cddb entry found at ./cddb_get.pl line 21.