Perl에서 오디오 CD의 CDDB 정보를 얻는 가장 좋은 방법은 무엇입니까?

StackOverflow https://stackoverflow.com/questions/2264723

  •  20-09-2019
  •  | 
  •  

문제

오디오 CD에서 CD 타이틀과 CD 트랙 이름을 얻는 가장 좋은 방법은 무엇입니까? 이 모듈을 시도했지만 작동하지 않았습니다.

#!/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.
도움이 되었습니까?

해결책

넣어보십시오

BEGIN { $CDDB_get::debug = 1 }

전에 use CDDB_get STDERR에 디버깅 출력을 얻으려면 라인.

다른 팁

모듈에서 FreedB의 API URL이 정확합니까?

CDDBP 대신 HTTP를 사용해 볼 수 있습니까?

에서 FreedB 문서:

CDDB1- 또는 FreedB-Aware 소프트웨어를 구성하여 CDDB/Freedb-Server로 FreedB.freedb.org (Random Freedb Server)를 가리 키도록 구성하십시오.

모든 공식 FreedB 서버는 포트 8880에서 CDDBP 및 포트 80에서 HTTP를 실행하고 있습니다. HTTP-Access의 경로는 /~cddb/cddb.cgi입니다.

나는 정보를 찾는 것을 고려할 것입니다 musicbrainz.org 대신에.

MusicBrainz :: Discid를 사용하여 CD와 WebService :: MusicBrainz의 디스크를 찾아 데이터를 검색합니다.

#!/usr/bin/perl

use strict;
use warnings;

use MusicBrainz::DiscID;
use WebService::MusicBrainz;

my $discid=MusicBrainz::DiscID->new;
if ( !$discid->read ) {
    print STDERR "Error: " . $discid->error_msg . "\n";
    exit 1;
}
print "DiscID: " . $discid->id . "\n";

my $service=WebService::MusicBrainz->new_release;
my $response=$service->search({ DISCID=>$discid->id });
my $release=$response->release;

print "ARTIST: " . $release->artist->name . "\n";
print "ALBUM:  " . $release->title . "\n";
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top