]> ruin.nu Git - ndwebbie.git/blobdiff - scripts/scans.pl
Don't parse a groupscan if we can't fetch it
[ndwebbie.git] / scripts / scans.pl
index 4f098c005fdda4151a49dbddbfa0cb39dd308278..6bfdb8e8d6e1e0da4abcae09c1a34184e3cc82a3 100755 (executable)
@@ -55,15 +55,17 @@ while (my $group = $scangroups->fetchrow_hashref){
        $dbh->begin_work;
        my $file = get("http://game.planetarion.com/showscan.pl?scan_grp=$group->{scan_id}");
 
-       my $points = 0;
-       while ($file =~ m/showscan.pl\?scan_id=(\w+)/g){
-               unless ($dbh->selectrow_array($oldscan,undef,$1)){
-                       $addScan->execute($1,$group->{tick},$group->{uid});
-                       ++$points;
+       if ($file){
+               my $points = 0;
+               while ($file =~ m/showscan.pl\?scan_id=(\w+)/g){
+                       unless ($dbh->selectrow_array($oldscan,undef,$1)){
+                               $addScan->execute($1,$group->{tick},$group->{uid});
+                               ++$points;
+                       }
                }
+               $addpoints->execute($points,$group->{uid});
+               $parsedscan->execute($group->{tick},'GROUP',undef,$group->{id});
        }
-       $addpoints->execute($points,$group->{uid});
-       $parsedscan->execute($group->{tick},'GROUP',undef,$group->{id});
        $dbh->commit;
 }