#
# Copyright (c) - 1998 Dirk Koopman G1TLH
#
-# $Id$
+#
#
package Spot;
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;
], 'Filter::Cmd');
$totalspots = $hfspots = $vhfspots = 0;
+$use_db_for_search = 0;
# create a Spot Object
sub new
my @out = @_[0..4]; # just up to the spotter
# normalise frequency
- $out[0] = sprintf "%.1f", $out[0]+0.05;
+ $out[0] = sprintf "%.1f", $out[0];
# remove ssids and /xxx if present on spotter
$out[4] =~ s/-\d+$//o;
$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);
}
# 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;
}
}
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);