X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FSpot.pm;h=3f5db145ee53c69494ee83852a46726b4f27c659;hb=4e6ea4e7991cf205a61637e16f5cf852399e7ad9;hp=dc63dbff42c1c2ab1309d843107e10ce6bbff4ae;hpb=defc60f3e7fab9bb99d1c9f7b8bccc4ec37628d5;p=spider.git diff --git a/perl/Spot.pm b/perl/Spot.pm index dc63dbff..3f5db145 100644 --- a/perl/Spot.pm +++ b/perl/Spot.pm @@ -17,6 +17,7 @@ use Julian; use Prefix; use DXDupe; use Data::Dumper; +use QSL; use strict; @@ -152,7 +153,7 @@ sub prepare sub add { - my $buf = join("\^", @_[0..7]); + my $buf = join("\^", @_); $fp->writeunix($_[2], $buf); $totalspots++; if ($_[0] <= 30000) { @@ -160,6 +161,10 @@ sub add } else { $vhfspots++; } + if ($_[3] =~ /(?:QSL|VIA)/i) { + my $q = QSL::get($_[1]) || new QSL $_[1]; + $q->update($_[3], $_[2], $_[4]); + } } # search the spot database for records based on the field no and an expression @@ -189,7 +194,7 @@ sub add sub search { - my ($expr, $dayfrom, $dayto, $from, $to, $hint) = @_; + my ($expr, $dayfrom, $dayto, $from, $to, $hint, $dxchan) = @_; my $eval; my @out; my $ref; @@ -228,6 +233,22 @@ sub search for (\$c = \$#spots; \$c >= 0; \$c--) { \$ref = \$spots[\$c]; if ($expr) { + if (\$dxchan && \$dxchan->{spotsfilter}) { + if (\@\$ref < 9) { + my \@dxcc = Prefix::cty_data(\$ref->[1]); + if (\@dxcc) { + pop \@dxcc; + push \@\$ref, \@dxcc; + } + \@dxcc = Prefix::cty_data(\$ref->[4]); + if (\@dxcc) { + pop \@dxcc; + push \@\$ref, \@dxcc; + } + } + my (\$filter, \$hops) = \$dxchan->{inspotsfilter}->it(\@\$ref); + next unless (\$filter); + } \$count++; next if \$count < \$from; # wait until from push(\@out, \$ref); @@ -235,6 +256,9 @@ sub search } } ); + + dbg("Spot eval: $eval") if isdbg('searcheval'); + $fp->close; # close any open files