]> ruin.nu Git - ndwebbie.git/blobdiff - scripts/scans.pl
ignore landing scans
[ndwebbie.git] / scripts / scans.pl
index 818be591e37d8937162fa6b98f2e3f59631d1d7a..7f80125552b0c40481de3077b69f7044252cd937 100755 (executable)
@@ -91,6 +91,8 @@ $dbh->begin_work or die 'No transaction';
 $newscans->execute or die $dbh->errstr;
 $dbh->pg_savepoint('scans') or die "No savepoint";
 
+my $parsedscans = 0;
+
 while (my $scan = $newscans->fetchrow_hashref){
        $dbh->pg_release('scans') or die "Couldn't save";
        $dbh->pg_savepoint('scans') or die "Couldn't save";
@@ -201,11 +203,13 @@ while (my $scan = $newscans->fetchrow_hashref){
                                my $id = addfleet($1,$2,$3,$planet,undef,$tick,undef,undef,$4);
                                $fleetscan->execute($id,$scan->{id}) or die $dbh->errstr;
                        }
+               } elsif($type eq 'Landing'){
                } else {
-                       print "Something wrong with scan $scan->{id} type $type at tick $tick http://game.planetarion.com/showscan.pl?scan_id=$scan->{scan_id}";
+                       print "Something wrong with scan $scan->{id} type $type at tick $tick http://game.planetarion.com/showscan.pl?scan_id=$scan->{scan_id}\n";
                }
                $parsedscan->execute($tick,$type,$planet,$scan->{id}) or die $dbh->errstr;
                #$dbh->rollback;
+               ++$parsedscans;
                };
                if ($@) {
                        warn $@;
@@ -220,6 +224,8 @@ while (my $scan = $newscans->fetchrow_hashref){
 #$dbh->rollback;
 $dbh->commit;
 
+system 'killall','-USR1', 'irssi' if $parsedscans;
+
 sub addfleet {
        my ($name,$mission,$ships,$sender,$target,$tick,$eta,$back,$amount,$ingal) = @_;