X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FSpot.pm;h=e7227ab1b2cdff4e313b95266b935756e2d0d5c5;hb=refs%2Fheads%2Fip_address;hp=5ea169f2f48021be9b6d37224feb32dc7737e63e;hpb=20efba5d5f656113144785e0ef84296e6d2c2e69;p=spider.git diff --git a/perl/Spot.pm b/perl/Spot.pm index 5ea169f2..e7227ab1 100644 --- a/perl/Spot.pm +++ b/perl/Spot.pm @@ -3,7 +3,7 @@ # # Copyright (c) - 1998 Dirk Koopman G1TLH # -# $Id$ +# # package Spot; @@ -21,13 +21,8 @@ use QSL; use strict; -use vars qw($VERSION $BRANCH); -$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ ); -$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0)); -$main::build += $VERSION; -$main::branch += $BRANCH; - -use vars qw($fp $statp $maxspots $defaultspots $maxdays $dirprefix $duplth $dupage $filterdef $totalspots $hfspots $vhfspots $maxcalllth); +use vars qw($fp $statp $maxspots $defaultspots $maxdays $dirprefix $duplth $dupage $filterdef + $totalspots $hfspots $vhfspots $maxcalllth $can_encode $use_db_for_search); $fp = undef; $statp = undef; @@ -58,6 +53,7 @@ $filterdef = bless ([ ], 'Filter::Cmd'); $totalspots = $hfspots = $vhfspots = 0; +$use_db_for_search = 0; # create a Spot Object sub new @@ -256,7 +252,7 @@ sub search $to = $from + $maxspots if $to - $from > $maxspots || $to - $from <= 0; - if ($main::dbh) { + if ($main::dbh && $use_db_for_search) { return $main::dbh->spot_search($expr, $dayfrom, $dayto, $to-$from, $dxchan); } @@ -394,7 +390,8 @@ sub dup # remove SSID or area $by =~ s|[-/]\d+$||; - $freq = sprintf "%.1f", $freq; # normalise frequency +# $freq = sprintf "%.1f", $freq; # normalise frequency + $freq = int $freq; # normalise frequency $call = substr($call, 0, $maxcalllth) if length $call > $maxcalllth; chomp $text; @@ -407,9 +404,10 @@ sub dup } } my $otext = $text; - $text = pack("C*", map {$_ & 127} unpack("C*", $text)); +# $text = Encode::encode("iso-8859-1", $text) if $main::can_encode && Encode::is_utf8($text, 1); + $text =~ s/^\+\w+\s*//; # remove leading LoTW callsign $text =~ s/\s{2,}[\dA-Z]?[A-Z]\d?$// if length $text > 24; - $text =~ s/[^\w]//g; + $text =~ s/[\W\x00-\x2F\x7B-\xFF]//g; # tautology, just to make quite sure! $text = substr($text, 0, $duplth) if length $text > $duplth; my $ldupkey = "X$freq|$call|$by|$text"; my $t = DXDupe::find($ldupkey);