remove '#' in bands.pl !!!!!!
[spider.git] / perl / Spot.pm
index 3d671d76ae0c90f20a54050b37498f98fc703120..9fcf3280d95ad8359516ee58c26e168114bb6f78 100644 (file)
@@ -41,6 +41,7 @@ $filterdef = bless ([
                                         ['info', 't', 3],
                                         ['spotter', 'c', 4],
                                         ['by', 'c', 4],
+                                        ['dxcc', 'nc', 5],
                                         ['call_dxcc', 'nc', 5],
                                         ['by_dxcc', 'nc', 6],
                                         ['origin', 'c', 7, 9],
@@ -63,7 +64,7 @@ $filterdef = bless ([
 $totalspots = $hfspots = $vhfspots = 0;
 $use_db_for_search = 0;
 
-our $readback = 0;
+our $readback = 1;
 
 if ($readback) {
        $readback = `which tac`;
@@ -88,7 +89,7 @@ sub decodefreq
        
        foreach $f (@f) {
                my ($a, $b); 
-               if (m{^\d+/\d+$}) {
+               if ($f =~ m{^\d+/\d+$}) {
                        push @out, $f;
                } elsif (($a, $b) = $f =~ m{^(\w+)(?:/(\w+))?$}) {
                        $b = lc $b if $b;
@@ -330,11 +331,20 @@ sub search
                        while (<$fh>) {
                                my @r = split /\^/;
                                ++$rec;
+                               if ($dxchan) {
+                                       my ($gotone, undef) = $dxchan->{spotsfilter}->it(@r);
+                                       next unless $gotone;
+                               }
                                if (&$ecode(\@r)) {
                                        ++$count;
                                        next if $count < $from;
-                                       push @out, \@r;
-                                       last if $count >= $to;
+                                       if ($readback) {
+                                               push @out, \@r;
+                                               last if $count >= $to;
+                                       } else {
+                                               push @out, \@r;
+                                               shift @out if $count >= $to;
+                                       }
                                }
                        }
                        dbg("Spot::search recs read: $rec") if isdbg('search');
@@ -384,24 +394,6 @@ sub formatl
        return sprintf "%8.1f  %-11s %s %s  %-28.28s%7s>", $_[0], $_[1], $d, $t, ($_[3]||''), "<$_[4]" ;
 }
 
-#
-# return all the spots from a day's file as an array of references
-# the parameter passed is a julian day
-sub readfile($)
-{
-       my @spots;
-       
-       my $fh = $fp->open(shift); 
-       if ($fh) {
-               my $in;
-               while (<$fh>) {
-                       chomp;
-                       push @spots, [ split '\^' ];
-               }
-       }
-       return @spots;
-}
-
 # enter the spot for dup checking and return true if it is already a dup
 sub dup
 {