r38159 - in /trunk/libcddb-get-perl: CDDB_cache.pm CDDB_get.pm Changes DATABASE MANIFEST META.yml cddb.pl debian/changelog debian/control 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:30:33 UTC 2009


Author: ryan52-guest
Date: Tue Jun 16 04:30:27 2009
New Revision: 38159

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=38159
Log:
* New upstream release
* Add myself to Uploaders
* Debian Policy 3.8.1

Added:
    trunk/libcddb-get-perl/CDDB_cache.pm
      - copied unchanged from r38158, branches/upstream/libcddb-get-perl/current/CDDB_cache.pm
    trunk/libcddb-get-perl/META.yml
      - copied unchanged from r38158, branches/upstream/libcddb-get-perl/current/META.yml
    trunk/libcddb-get-perl/perl-CDDB_get-2.27.spec
      - copied unchanged from r38158, branches/upstream/libcddb-get-perl/current/perl-CDDB_get-2.27.spec
Removed:
    trunk/libcddb-get-perl/perl-CDDB_get-2.11.spec
Modified:
    trunk/libcddb-get-perl/CDDB_get.pm
    trunk/libcddb-get-perl/Changes
    trunk/libcddb-get-perl/DATABASE
    trunk/libcddb-get-perl/MANIFEST
    trunk/libcddb-get-perl/cddb.pl
    trunk/libcddb-get-perl/debian/changelog
    trunk/libcddb-get-perl/debian/control

Modified: trunk/libcddb-get-perl/CDDB_get.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcddb-get-perl/CDDB_get.pm?rev=38159&op=diff
==============================================================================
--- trunk/libcddb-get-perl/CDDB_get.pm (original)
+++ trunk/libcddb-get-perl/CDDB_get.pm Tue Jun 16 04:30:27 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: trunk/libcddb-get-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcddb-get-perl/Changes?rev=38159&op=diff
==============================================================================
--- trunk/libcddb-get-perl/Changes (original)
+++ trunk/libcddb-get-perl/Changes Tue Jun 16 04:30:27 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: trunk/libcddb-get-perl/DATABASE
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcddb-get-perl/DATABASE?rev=38159&op=diff
==============================================================================
--- trunk/libcddb-get-perl/DATABASE (original)
+++ trunk/libcddb-get-perl/DATABASE Tue Jun 16 04:30:27 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: trunk/libcddb-get-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcddb-get-perl/MANIFEST?rev=38159&op=diff
==============================================================================
--- trunk/libcddb-get-perl/MANIFEST (original)
+++ trunk/libcddb-get-perl/MANIFEST Tue Jun 16 04:30:27 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)

Modified: trunk/libcddb-get-perl/cddb.pl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcddb-get-perl/cddb.pl?rev=38159&op=diff
==============================================================================
--- trunk/libcddb-get-perl/cddb.pl (original)
+++ trunk/libcddb-get-perl/cddb.pl Tue Jun 16 04:30:27 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++;
   }

Modified: trunk/libcddb-get-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcddb-get-perl/debian/changelog?rev=38159&op=diff
==============================================================================
--- trunk/libcddb-get-perl/debian/changelog (original)
+++ trunk/libcddb-get-perl/debian/changelog Tue Jun 16 04:30:27 2009
@@ -1,4 +1,4 @@
-libcddb-get-perl (2.23-2.2) UNRELEASED; urgency=low
+libcddb-get-perl (2.27-1) UNRELEASED; urgency=low
 
   * Take over for the Debian Perl Group; Closes: #533086 -- RFA
   * debian/control: Added: Vcs-Svn field (source stanza); Vcs-Browser
@@ -8,8 +8,11 @@
     Lucas Wall <lwall at debian.org>); Lucas Wall <lwall at debian.org> moved
     to Uploaders.
   * debian/watch: use dist-based URL.
+  * New upstream release
+  * Add myself to Uploaders
+  * Debian Policy 3.8.1
 
- -- Ryan Niebur <ryanryan52 at gmail.com>  Mon, 15 Jun 2009 21:22:02 -0700
+ -- Ryan Niebur <ryanryan52 at gmail.com>  Mon, 15 Jun 2009 21:30:18 -0700
 
 libcddb-get-perl (2.23-2.1) unstable; urgency=low
 

Modified: trunk/libcddb-get-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcddb-get-perl/debian/control?rev=38159&op=diff
==============================================================================
--- trunk/libcddb-get-perl/debian/control (original)
+++ trunk/libcddb-get-perl/debian/control Tue Jun 16 04:30:27 2009
@@ -3,8 +3,8 @@
 Priority: optional
 Build-Depends-Indep: debhelper (>= 4.0.0), perl (>= 5.8.0-7)
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Lucas Wall <lwall at debian.org>
-Standards-Version: 3.6.1.0
+Uploaders: Lucas Wall <lwall at debian.org>, Ryan Niebur <ryanryan52 at gmail.com>
+Standards-Version: 3.8.1
 Homepage: http://search.cpan.org/dist/CDDB_get/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libcddb-get-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libcddb-get-perl/




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