]> ruin.nu Git - ndwebbie.git/blobdiff - scripts/parsedumps.pl
Use ND::DB module instead of db.pl
[ndwebbie.git] / scripts / parsedumps.pl
index 106922b4d4d781adbfdea6359ab55a9d3606b852..d22525fd87b776a83a393db456157ed97ac73507 100755 (executable)
@@ -27,20 +27,12 @@ use DBD::Pg qw(:pg_types);
 
 use LWP::Simple;
 
-use lib qw{/var/www/ndawn/code/};
+use lib qw{/var/www/ndawn/};
 
 use ND::Include;
+use ND::DB;
 
-our $dbh;
-for my $file ("/home/whale/db.pl")
-{
-       unless (my $return = do $file){
-               warn "couldn't parse $file: $@" if $@;
-               warn "couldn't do $file: $!"    unless defined $return;
-               warn "couldn't run $file"       unless $return;
-       }
-}
-#$dbh->trace("0","/tmp/parsedumps");
+our $dbh = ND::DB::DB();
 
 $ND::DBH = $dbh;
 
@@ -113,7 +105,7 @@ if (@_ = $dumps->fetchrow){
        $_ = $_[0];
        $hour = (gmtime($_[1]))[2];
        my $planetid = $dbh->prepare(qq{SELECT findplanetid(?,?,?)});
-       while (m/(\d+)\t(\d+)\t(\d+)\t\"(.+)\"\t\"(.+)\"\t(Ter|Cat|Zik|Xan|Etd)\t(\d+)\t(\d+)\t(\d+)\t(\d+)/g){
+       while (m/(\d+)\t(\d+)\t(\d+)\t\"(.*)\"\t\"(.*)\"\t(Ter|Cat|Zik|Xan|Etd)\t(\d+)\t(\d+)\t(\d+)\t(\d+)/g){
                $planetid->execute($5,$4,$6);
                my @id = $planetid->fetchrow;
                push @planets,[$tick,$id[0],$1,$2,$3,$7,$8,$9,$10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];