r38157 - in /branches/upstream/libcddb-get-perl/current: CDDB_cache.pm CDDB_get.pm Changes DATABASE MANIFEST META.yml cddb.pl perl-CDDB_get-2.11.spec perl-CDDB_get-2.27.spec

ryan52-guest at users.alioth.debian.org ryan52-guest at users.alioth.debian.org
Tue Jun 16 04:29:45 UTC 2009


Author: ryan52-guest
Date: Tue Jun 16 04:29:39 2009
New Revision: 38157

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=38157
Log:
[svn-upgrade] Integrating new upstream version, libcddb-get-perl (2.27)

Added:
    branches/upstream/libcddb-get-perl/current/CDDB_cache.pm
    branches/upstream/libcddb-get-perl/current/META.yml
    branches/upstream/libcddb-get-perl/current/perl-CDDB_get-2.27.spec
Removed:
    branches/upstream/libcddb-get-perl/current/perl-CDDB_get-2.11.spec
Modified:
    branches/upstream/libcddb-get-perl/current/CDDB_get.pm
    branches/upstream/libcddb-get-perl/current/Changes
    branches/upstream/libcddb-get-perl/current/DATABASE
    branches/upstream/libcddb-get-perl/current/MANIFEST
    branches/upstream/libcddb-get-perl/current/cddb.pl

Added: branches/upstream/libcddb-get-perl/current/CDDB_cache.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcddb-get-perl/current/CDDB_cache.pm?rev=38157&op=file
==============================================================================
--- branches/upstream/libcddb-get-perl/current/CDDB_cache.pm (added)
+++ branches/upstream/libcddb-get-perl/current/CDDB_cache.pm Tue Jun 16 04:29:39 2009
@@ -1,0 +1,203 @@
+#
+#  CDDB - Read the CDDB entry for an audio CD in your drive
+#
+#  This module/script gets the CDDB info for an audio cd. You need
+#  LINUX, a cdrom drive and an active internet connection in order
+#  to do that.
+#
+#  (c) 2004 Armin Obersteiner <armin at xos.net>
+#
+#  LICENSE
+#
+#  This library is released under the same conditions as Perl, that
+#  is, either of the following:
+#
+#  a) the GNU General Public License Version 2 as published by the
+#  Free Software Foundation,
+#
+#  b) the Artistic License.
+#
+
+package CDDB_cache;
+
+use strict;
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $debug $dir $readonly $grep);
+
+require Exporter;
+
+ at ISA = qw(Exporter AutoLoader);
+# Items to export into callers namespace by default. Note: do not export
+# names by default without a very good reason. Use EXPORT_OK instead.
+# Do not simply export all your public functions/methods/constants.
+ at EXPORT_OK = qw(
+  get_cddb
+  get_discids
+);
+$VERSION = '1.0';
+
+use CDDB_get;
+use File::Find;
+use Data::Dumper qw(Dumper);
+
+#$debug=1;
+$dir="/tmp/xmcd";
+
+my $CD_DEVICE = "/dev/cdrom";
+
+sub get_discids {
+  my $cd=shift;
+
+  return CDDB_get::get_discids($cd);
+}
+
+my @files;
+
+sub get_cddb {
+  my $config=shift;
+  my $diskid=shift;
+
+  if($debug) {
+    print STDERR "dir: [$dir]  readonly [$readonly]  grep [$grep]\n";
+  }
+
+  $config->{multi}=0;
+  $CD_DEVICE = $config->{CD_DEVICE} if (defined($config->{CD_DEVICE}));
+
+  my $did=$diskid;
+  $did=CDDB_get::get_discids($CD_DEVICE) unless($did);
+  #print Dumper($did);
+ 
+  printf STDERR "%08x %08lx\n", $did->[0],  $did->[0] if($debug);
+ 
+  my $sid = sprintf "%08x", $did->[0];
+  my $id = sprintf "%08x %d", $did->[0], $did->[1];
+  for(0..$did->[1]-1) {
+    $id.=" ".$did->[2]->[$_]->{frames};
+  }
+  $id.=" ".int($did->[2]->[$did->[1]]->{frames}/75);
+  print STDERR "id: $id\n" if $debug;
+
+  @files=();
+  if($grep) {
+    find({ wanted => sub {
+      next unless -f $File::Find::name;
+      my $tid=`grep -H $sid $File::Find::name`;
+      if($tid =~ /\S+/) {
+        push @files, $File::Find::name;
+      } 
+    }, follow=>1}, $dir);
+  } else {
+    find({ wanted => sub {
+      if($_ eq $sid) {
+        push @files, $File::Find::name;
+      } 
+    }, follow=>1}, $dir);
+  }
+  print STDERR Dumper(\@files) if $debug;
+
+  my $file;
+  my $found;
+
+  for(@files) {
+    open IN,$_;
+    undef $/;
+    $file=<IN>;
+    close IN;
+
+    my ($fid)=$file =~ /DISCID=(\S+)/i;
+    my ($len)=$file =~ /Disc length: (\d+) seconds/i;
+    my ($s)=$file =~ /Track frame offsets:\s+(.*)\s+Disc length/si;
+    my $t="";
+    my @tr=split /#/,$s;
+    my $c=0;
+    for(@tr) {
+      next unless /(\d+)/;
+      $c++;
+      $t.=" $1";
+      last if($c>=$did->[1]);
+    }
+    my $tid="$fid $c$t $len";
+
+    if($tid eq $id) {
+      $found=$_;
+      last;
+    }
+  }
+
+  my $toc=$did->[2];
+
+  my %cd;
+  if($found) {
+    print STDERR "CDDB_cache: reading from file: $found\n";
+
+    my @lines=split /\n/,$file;
+    for(@lines) {
+      push @{$cd{raw}},$_."\n";
+      #TTITLE0=Bitch (Edit)
+      if(/^TTITLE(\d+)\=\s*(.*)/) {
+        my $t= $2;
+        chomp $t;
+        $cd{frames}[$1]=$toc->[$1]->{frames};
+        $cd{data}[$1]=$toc->[$1]->{data};
+        unless (defined $cd{track}[$1]) {
+          $cd{track}[$1]=$t;
+        } else {
+          $cd{track}[$1]=$cd{track}[$1].$t;
+        }
+      } elsif(/^DYEAR=\s*(\d+)/) {
+        $cd{'year'} = $1;
+      } elsif(/^DGENRE=\s*(\S+.*)/) {
+        my $t = $1;
+        chomp $t;
+        $cd{'genre'} = $t;
+      }
+    }
+
+    $cd{tno}=$#{$cd{track}}+1;
+    $cd{frames}[$cd{tno}]=$toc->[$cd{tno}]->{frames};
+
+    $cd{id}=$sid;
+
+    my ($at)=$file=~/DTITLE=(.*?)\n/;
+    my ($artist,$title);
+    #chop $at if($at =~ /\r/);
+    chomp $at;
+
+    if($at =~ /\//) {
+      ($artist,$title)= $at =~ /^(.*?)\s\/\s(.*)/;
+    } else {
+      $artist=$at;
+      $title=$at;
+    }
+
+    $cd{artist}=$artist;
+    $cd{title}=$title;
+
+    my ($cat) = $found =~ /$dir\/(\S+?)\/$sid/;
+    $cd{cat}=$cat;
+
+  } else {
+    print STDERR "CDDB_cache: reading from network\n";
+
+    %cd=CDDB_get::get_cddb($config,$diskid);
+  }
+
+  print STDERR Dumper(\%cd) if $debug;
+
+  unless($readonly || $found) {
+    my $file=$dir."/$cd{cat}/$cd{id}";
+    my $ddir=$dir."/$cd{cat}";
+    mkdir $ddir,0755;   
+
+    open OUT,">$file";
+    for(@{$cd{raw}}) {
+      print OUT $_;
+    }
+    close OUT;
+  }
+
+  return %cd;
+}
+
+1;
+__END__

Modified: branches/upstream/libcddb-get-perl/current/CDDB_get.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcddb-get-perl/current/CDDB_get.pm?rev=38157&op=diff
==============================================================================
--- branches/upstream/libcddb-get-perl/current/CDDB_get.pm (original)
+++ branches/upstream/libcddb-get-perl/current/CDDB_get.pm Tue Jun 16 04:29:39 2009
@@ -5,7 +5,7 @@
 #  LINUX, a cdrom drive and an active internet connection in order
 #  to do that.
 #
-#  (c) 2003 Armin Obersteiner <armin at xos.net>
+#  (c) 2004 Armin Obersteiner <armin at xos.net>
 #
 #  LICENSE
 #
@@ -35,7 +35,7 @@
   get_cddb
   get_discids
 );
-$VERSION = '2.23';
+$VERSION = '2.27';
 
 use Fcntl;
 use IO::Socket;
@@ -66,7 +66,7 @@
 # default config
 
 my $CDDB_HOST = "freedb.freedb.org";
-my $CDDB_PORT = 888;
+my $CDDB_PORT = 8880;
 my $CDDB_MODE = "cddb";
 my $CD_DEVICE = "/dev/cdrom";
 
@@ -129,7 +129,7 @@
 
 sub read_toc {
   my $device=shift;
-  my $tochdr="";
+  my $tochdr=chr(0) x 16;
 
   sysopen (CD,$device, O_RDONLY | O_NONBLOCK) or die "cannot open cdrom [$!] [$device]";
   ioctl(CD, $CDROMREADTOCHDR, $tochdr) or die "cannot read toc [$!] [$device]";
@@ -184,6 +184,7 @@
     my ($min,$sec,$frame);
     unless($os =~ /BSD/) {
       $tocentry=pack "CCC", $i,0,$CDROM_MSF;
+      $tocentry.=chr(0) x 16;
       ioctl(CD, $CDROMREADTOCENTRY, $tocentry) or die "cannot read track $i info [$!] [$device]";
       ($min,$sec,$frame)=unpack "CCCC", substr($tocentry,4,4);
     } else {
@@ -347,12 +348,19 @@
     my $host=$CDDB_HOST;
     my $port=80;
 
+    my ($user,$pass);
+
     if($HTTP_PROXY) {
-      if($HTTP_PROXY =~ /^(http:\/\/|)(.+?):(\d+)/) {
+      if($HTTP_PROXY =~ /^(http:\/\/|)(.+?):(.+)\@(.+?):(.+)/) {
+        $user=$2;
+        $pass=$3;
+        $host=$4;
+        $port=$5;
+      } elsif($HTTP_PROXY =~ /^(http:\/\/|)(.+?):(\d+)/) {
         $host=$2;
         $port=$3;
-        $url="http://$CDDB_HOST".$url." HTTP/1.0\n";
-      }
+      }
+      $url="http://$CDDB_HOST".$url." HTTP/1.0";
     }
 
     print STDERR "cddb: connecting to $host:$port\n" if $debug;
@@ -362,6 +370,13 @@
 
     print STDERR "cddb: http send: GET $url\n" if $debug;
     print $socket "GET $url\n";
+
+    if($user) {
+      my $cred = encode_base64("$user:$pass");
+      print $socket "Proxy-Authorization: Basic $cred\n";
+    }
+
+    print $socket "\n";
     print $socket "\n" if $FW;
 
     if($HTTP_PROXY) {
@@ -447,6 +462,7 @@
     my %cd=();
     $cd{artist}=$artist;
     chomp $title;
+    $title =~ s/\r//g;
     $cd{title}=$title;
     $cd{cat}=$cat;
     $cd{id}=$id;
@@ -481,12 +497,19 @@
       my $host=$CDDB_HOST;
       my $port=80;
 
+      my ($user,$pass);
+
       if($HTTP_PROXY) {
-        if($HTTP_PROXY =~ /^(http:\/\/|)(.+?):(\d+)/) {
+        if($HTTP_PROXY =~ /^(http:\/\/|)(.+?):(.+)\@(.+?):(.+)/) {
+          $user=$2;
+          $pass=$3;
+          $host=$4;
+          $port=$5;
+        } elsif($HTTP_PROXY =~ /^(http:\/\/|)(.+?):(\d+)/) {
           $host=$2;
           $port=$3;
-          $url="http://$CDDB_HOST".$url." HTTP/1.0\n";
         }
+        $url="http://$CDDB_HOST".$url." HTTP/1.0";
       }
 
       print STDERR "cddb: connecting to $host:$port\n" if $debug;
@@ -496,6 +519,13 @@
 
       print STDERR "cddb: http send: GET $url\n" if $debug;
       print $socket "GET $url\n";
+
+      if($user) {
+        my $cred = encode_base64("$user:$pass");
+        print $socket "Proxy-Authorization: Basic $cred\n";
+      }
+
+      print $socket "\n";
       print $socket "\n" if $FW;
 
       if($HTTP_PROXY) {
@@ -510,6 +540,19 @@
     } else {
       die "unkown mode: $CDDB_MODE for querying cddb";
     }
+
+    # xmcd
+    #
+    # Track frame offsets:
+    #	150
+    # ...
+    #	210627
+    #
+    # Disc length: 2952 seconds
+    #
+    # Revision: 1
+    # Submitted via: xmcd 2.0
+    #
 
     for(@lines) {
       last if(/^\./);
@@ -532,6 +575,8 @@
         my $t = $1;
         chop $t;
         $cd{'genre'} = $t;
+      } elsif(/^\#\s+Revision:\s+(\d+)/) {
+        $cd{'revision'} = $1;
       }
     }
 

Modified: branches/upstream/libcddb-get-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcddb-get-perl/current/Changes?rev=38157&op=diff
==============================================================================
--- branches/upstream/libcddb-get-perl/current/Changes (original)
+++ branches/upstream/libcddb-get-perl/current/Changes Tue Jun 16 04:29:39 2009
@@ -77,3 +77,19 @@
       (thanks to: Enache Adrian, Jolan Luff and Dan Weeks)
       pod cleanup
 
+2.25  15.06.2005
+      user:pass with proxy support - untested (thanks to Peter)
+        Please try it, I don't have such a setup.
+      Cache module: use CDDB_cache instead of CDDB_get
+        All files are saved in a local tree and can be reused from there.
+        Please try it if you like, it's not really tested.
+
+2.26  22.06.2005 (unreleased)
+      added postgres/oracle/sqlite support (untested)
+      thanks to Rick for starting with a postgres version
+
+2.27  01.01.2006
+      default port is now 8880 (not 888 anymore)
+      fixes an ioctl perl problem on current redhat/fedora (thanks to Gregory K. Ruiz-Ade
+      and the redhat/fedora guys)
+

Modified: branches/upstream/libcddb-get-perl/current/DATABASE
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcddb-get-perl/current/DATABASE?rev=38157&op=diff
==============================================================================
--- branches/upstream/libcddb-get-perl/current/DATABASE (original)
+++ branches/upstream/libcddb-get-perl/current/DATABASE Tue Jun 16 04:29:39 2009
@@ -1,4 +1,4 @@
-# this a the database example of Falko
+; this a the database example of Falko
 
 CREATE TABLE cds (
   cddbid varchar(20) NOT NULL default '',
@@ -12,7 +12,9 @@
 CREATE TABLE tracks (
   cddbid varchar(20) NOT NULL default '',
   title varchar(250) NOT NULL default '',
-  trackno tinyint(2) NOT NULL default '0',
+  ; better for mysql: trackno tinyint(2)
+  ; better for postgres: trackno smallint
+  trackno integer NOT NULL default '0',
   time time NOT NULL default '00:00:00'
 );
 

Modified: branches/upstream/libcddb-get-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcddb-get-perl/current/MANIFEST?rev=38157&op=diff
==============================================================================
--- branches/upstream/libcddb-get-perl/current/MANIFEST (original)
+++ branches/upstream/libcddb-get-perl/current/MANIFEST Tue Jun 16 04:29:39 2009
@@ -1,12 +1,13 @@
 Artistic
 Copying
 CDDB_get.pm
+CDDB_cache.pm
 cddb.pl
 Changes
 MANIFEST
 README
 DATABASE
-perl-CDDB_get-2.23.spec
+perl-CDDB_get-2.27.spec
 Makefile.PL
 t/use.t
 META.yml                                Module meta-data (added by MakeMaker)

Added: branches/upstream/libcddb-get-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcddb-get-perl/current/META.yml?rev=38157&op=file
==============================================================================
--- branches/upstream/libcddb-get-perl/current/META.yml (added)
+++ branches/upstream/libcddb-get-perl/current/META.yml Tue Jun 16 04:29:39 2009
@@ -1,0 +1,10 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
+name:         CDDB_get
+version:      2.27
+version_from: CDDB_get.pm
+installdirs:  site
+requires:
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.30

Modified: branches/upstream/libcddb-get-perl/current/cddb.pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcddb-get-perl/current/cddb.pl?rev=38157&op=diff
==============================================================================
--- branches/upstream/libcddb-get-perl/current/cddb.pl (original)
+++ branches/upstream/libcddb-get-perl/current/cddb.pl Tue Jun 16 04:29:39 2009
@@ -6,7 +6,7 @@
 #  LINUX, a cdrom drive and an active internet connection in order
 #  to do that.
 #
-#  (c) 2003 Armin Obersteiner <armin at xos.net>
+#  (c) 2004 Armin Obersteiner <armin at xos.net>
 #
 #  LICENSE
 #
@@ -19,7 +19,7 @@
 #  b) the Artistic License.
 #
 
-use CDDB_get qw( get_cddb get_discids );
+#use CDDB_get qw( get_cddb get_discids );
 
 use Data::Dumper;
 use Getopt::Std;
@@ -27,7 +27,7 @@
 use strict;
 
 my %option = ();
-getopts("oghdtsiSfDlOFc:", \%option); 
+getopts("oghdtsi:SfDlOFc:H:CIRGP", \%option); 
 
 if($option{h}) {
   print "$0: gets CDDB info of a CD\n";
@@ -36,13 +36,19 @@
   print "  -o  offline mode - just stores CD info\n";
   print "  -d  output in xmcd format\n";
   print "  -s  save in xmcd format\n";
-  print "  -i  write to mysql db\n";
+  print "  -i  db. one of: mysql, pg, oracle, sqlite\n";
   print "  -O  overwrite file or db\n";
   print "  -t  output toc\n";
   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;
 }
@@ -55,18 +61,41 @@
 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
-# $config{CDDB_PORT}=888; 			# set cddb port
+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
 
-$CDDB_get::debug=1 if($option{D});
 
 # get proxy settings for cddb mode
 
@@ -87,27 +116,57 @@
 $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{host} = "localhost:3306";
-  $db{name} = "mp3-test";
   $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}) {
   my $ids=get_discids($config{CD_DEVICE});
 
   unless(-e $savedir) {
-    mkdir $savedir,0755 || die "cannot create $savedir";
-  }
-
-  open OUT,">$savedir/$ids->[0]\_$$" || die "cannot open outfile";
+    mkdir $savedir,0755 or die "cannot create $savedir";
+  }
+
+  open OUT,">$savedir/$ids->[0]\_$$" or die "cannot open outfile";
   print OUT Data::Dumper->Dump($ids,["diskid","total","toc"]);
   close OUT;
 
@@ -118,7 +177,7 @@
 if($option{g}) {
   print STDERR "retrieving stored cds ...\n";
 
-  opendir(DIR, $savedir) || die "cannot opendir $savedir";
+  opendir(DIR, $savedir) or die "cannot opendir $savedir";
   while (defined(my $file = readdir(DIR))) {
     next if($file =~ /^\./);
     print "\n";
@@ -280,7 +339,7 @@
 
   if($save) {
     unless(-e $xmcddir) {
-      mkdir $xmcddir,0755 || die "cannot create $savedir";
+      mkdir $xmcddir,0755 or die "cannot create $savedir";
     }
 
     unless($option{O}) {
@@ -290,7 +349,7 @@
       }
     }
 
-    open XMCD,">$xmcddir/$cd->{id}" || die "cannot open outfile";
+    open XMCD,">$xmcddir/$cd->{id}" or die "cannot open outfile";
     *OUT=*XMCD;
   }
 
@@ -312,8 +371,7 @@
     ($cd->{artist}, $cd->{title}, $cd->{cat}, $cd->{id}, $cd->{tno});
 
   my $sql = "SELECT cddbid FROM $db->{table_cds} WHERE CDDBID = \'$cddbid\'";
-  my $dbh = DBI->connect("dbi:mysql:$db->{name}:$db->{host}",
-    $db->{user},$db->{passwd}) or die "cannot connect to db: $DBI::errstr";
+  my $dbh = DBI->connect($db->{connect}->()) or die "cannot connect to db: $DBI::errstr";
   my $sth = $dbh->prepare($sql);
   my $r = $sth->execute or die "cannot check for cd: $DBI::errstr";
   if ($r == 1) {
@@ -374,9 +432,10 @@
   my $n=1;
   for my $i ( @{$cd->{track}} ) {
     $i =~ s/"/'/g;
-    print 'lame --ta "'.$cd->{title}.'" --tl "'.$cd->{artist}.'" --tt "'.$i.'" ';
+    print 'lame --tl "'.$cd->{title}.'" --ta "'.$cd->{artist}.'" --tt "'.$i.'" ';
     printf "audio_%02d.wav ",$n;
-    $i =~ s/[^\S]|['"]/_/g;
+    $i =~ s/[^\S]|['"\/]/_/g;
+    $i =~ s/_+-_+/-/g;
     print " $i.mp3\n";
     $n++;
   }

Added: branches/upstream/libcddb-get-perl/current/perl-CDDB_get-2.27.spec
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcddb-get-perl/current/perl-CDDB_get-2.27.spec?rev=38157&op=file
==============================================================================
--- branches/upstream/libcddb-get-perl/current/perl-CDDB_get-2.27.spec (added)
+++ branches/upstream/libcddb-get-perl/current/perl-CDDB_get-2.27.spec Tue Jun 16 04:29:39 2009
@@ -1,0 +1,50 @@
+%define module	CDDB_get
+%define version 2.27
+%define release 1
+Summary:	%{module} module for perl
+Name:		perl-%{module}
+Version:	%{version}
+Release:	%{release}
+License:	distributable
+Group:		Applications/Multimedia
+Source0:	%{module}-%{version}.tar.gz
+Url:		http://armin.emx.at/cddb/
+BuildRoot:	%{_tmppath}/%{name}-buildroot/
+Requires:	perl >= 5.6.1
+BuildArch:	noarch
+
+%description
+%{module} module for perl
+
+%prep
+%setup -q -n %{module}-%{version}
+
+%build
+CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL
+make
+make test
+
+%clean 
+rm -rf $RPM_BUILD_ROOT
+
+%install
+rm -rf $RPM_BUILD_ROOT
+eval `perl '-V:installarchlib'`
+mkdir -p $RPM_BUILD_ROOT/$installarchlib
+make PREFIX=$RPM_BUILD_ROOT%{_prefix} install
+
+# call spec-helper before creating the file list
+s=/usr/share/spec-helper/spec-helper ; [ -x $s ] && $s
+
+%files 
+%defattr(-,root,root)
+%{_mandir}/*/*
+%{_prefix}/lib/perl5/site_perl/*/auto/CDDB_get/*
+%{_prefix}/lib/perl5/site_perl/*/cddb.pl
+%{_prefix}/lib/perl5/site_perl/*/CDDB_get.pm
+%doc Changes Copying README DATABASE
+
+%changelog
+* Mon Mar 11 04:14:26 MET 2002 Armin Obersteiner <armin(at)xos(dot)net> 2.01-1
+* Sun Nov 25 2001 Peter Bieringer <pb at bieringer.de> 1.66-1
+- initial (creditds to spec file creators of perl-DateManip)




More information about the Pkg-perl-cvs-commits mailing list