從音頻CD獲取CD標題和CD軌道名稱的最佳方法是什麼? 我試過這個模塊,但沒有奏效。在Perl中獲取音頻CD的CDDB信息的最佳方式是什麼?
#!/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.
「它不工作」 =? – bzlm
什麼,更具體地說,沒有工作? –
Uups,它工作,但不是所有的CD。 –