Read the cddb entry for an audio cd in your drive
use CDDB_get qw( get_cddb );
my %config;
# following variables just need to be declared if different from defaults
$config{CDDB_HOST}="freedb.freedb.org"; # set cddb host
$config{CDDB_PORT}=8880; # set cddb port
$config{CDDB_MODE}="cddb"; # set cddb mode: cddb or http
$config{CD_DEVICE}="/dev/cdrom"; # set cd device
# user interaction welcome?
$config{input}=1; # 1: ask user if more than one possibility
# 0: no user interaction
# get it on
my %cd=get_cddb(\%config);
unless(defined $cd{title}) {
die "no cddb entry found";
}
# do somthing with the results
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;
foreach my $i ( @{$cd{track}} ) {
print "track $n: $i\n";
$n++;
}
This module/script gets the \s-1CDDB\s0 info for an audio cd. You need \s-1LINUX\s0, \s-1SUNOS\s0 or *BSD, a cdrom drive and an active internet connection in order to do that.
Run \*(L"perl Makefile.pl\*(R" as usual. (\*(L"make\*(R", \*(L"make install\*(R" next)
This library is released under the same conditions as Perl, that is, either of the following:
a) the \s-1GNU\s0 General Public License Version 2 as published by the Free Software Foundation,
b) the Artistic License.
This program is distributed in the hope that it will be useful, but \s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. See either the \s-1GNU\s0 General Public License or the Artistic License for more details.
You should have received a copy of the Artistic License with this Kit, in the file named \*(L"Artistic\*(R". If not, I'll be glad to provide one.
You should also have received a copy of the \s-1GNU\s0 General Public License along with this program, in the file names \*(L"Copying\*(R"; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, \s-1MA\s0 02111-1307, \s-1USA\s0.
If you use this library in a commercial enterprise, you are invited, but not required, to pay what you feel is a reasonable fee to the author, who can be contacted at [email protected]
(c) 2003 Armin Obersteiner <armin(at)xos(dot)net>
perl\|(1), Linux: /usr/include/linux/cdrom.h, Solaris, *BSD: /usr/include/sys/cdio.h.