CDDB_get
view release on metacpan or search on metacpan
print " -l output lame command\n";
print " -f http mode (e.g. through firewalls)\n";
print " -F some stateful firewalls/http proxies need additional newlines\n";
print " -g get CDDB info for stored CDs\n";
print " -I non interactive mode\n";
print " -H CDDB hostname\n";
print " -C use local cache\n";
print " -R readonly cache\n";
print " -G cache has not the diskid as filenames (much slower)\n";
print " -P cache path (default: /tmp/xmcd)\n";
print " -D put CDDB_get in debug mode\n";
exit;
}
my %config;
my $diskid;
my $total;
my $toc;
my $savedir="/tmp/cddb";
my $xmcddir="/tmp/xmcd";
if($option{C}) {
# use CDDB_cache qw( get_cddb get_discids );
require CDDB_cache;
CDDB_cache->import( qw( get_cddb get_discids ) );
$CDDB_cache::debug=1 if($option{D});
$CDDB_cache::readonly=1 if($option{R});
$CDDB_cache::grep=1 if($option{G});
$CDDB_cache::dir="/tmp/xmcd"; # default
# $CDDB_cache::dir="/opt/kde2/share/apps/kscd/cddb";
$CDDB_cache::dir=$option{P} if($option{P});
} else {
# use CDDB_get qw( get_cddb get_discids );
require CDDB_get;
CDDB_get->import( qw( get_cddb get_discids ) );
}
$CDDB_get::debug=1 if($option{D});
# following variables just need to be declared if different from defaults
# defaults are listed below (cdrom default is os specific)
# $config{CDDB_HOST}="freedb.freedb.org"; # set cddb host
if($option{H}) {
$config{CDDB_HOST}=$option{H};
}
# $config{CDDB_PORT}=8880; # set cddb port
# $config{CDDB_MODE}="cddb"; # set cddb mode: cddb or http, this is switched with -f
# $config{CD_DEVICE}="/dev/cdrom"; # set cd device
# $config{HELLO_ID} ="root nowhere.com fastrip 0.77"; # hello string: username hostname clientname version
# $config{PROTO_VERSION} = 5; # cddb protokol version
# get proxy settings for cddb mode
$config{HTTP_PROXY}=$ENV{http_proxy} if $ENV{http_proxy}; # maybe wanna use a proxy ?
$config{CDDB_MODE}="http" if($option{f});
if($option{F}) {
$config{CDDB_MODE}="http";
$config{FW}=1;
}
$config{CD_DEVICE}=$option{c} if $option{c};
# user interaction welcome?
$config{input}=1; # 1: ask user if more than one possibility
# 0: no user interaction
$config{multi}=0; # 1: do not ask user and get all of them
# 0: just the first one
$config{input}=0 if($option{I});
my %db;
if($option{i}) {
require DBI;
$db{table_cds} = "cds";
$db{table_tracks} = "tracks";
# not needed for sqlite
$db{host} = "localhost";
$db{port} = "3306";
# not needed for oracle/sqlite
$db{name} = "mp3-test";
# just for oracle
$db{sid} = "xxx";
$db{home} = "xxx";
# just for sqlite
$db{file} = "xxx";
# not needed for sqlite
$db{user} = "root";
$db{passwd} = "xxx";
if($option{i} eq "mysql") {
$db{connect} = sub { "dbi:mysql:database=$db{name};host=$db{host};port=$db{port}", $db{user}, $db{passwd} };
} elsif($option{i} eq "pg") {
$db{connect} = sub { "dbi:Pg:dbname=$db{dbname};host=$db{host};port=$db{port}", $db{user}, $db{passwd} };
} elsif($option{i} eq "oracle") {
$db{connect} = sub { "dbi:Oracle:host=$db{host};sid=$db{sid};port=$db{port}", $db{user}, $db{passwd} };
$ENV{ORACLE_HOME} = $db{home};
} elsif($option{i} eq "sqlite") {
$db{connect} = sub { "dbi:SQLite:dbname=$db{file}","","" };
} else {
die "unkown database: $option{i}";
}
}
if($option{o}) {
( run in 0.636 second using v1.01-cache-2.11-cpan-71847e10f99 )