+12Oct02=======================================================================
+1. attempt to improve the "check back for 5 minutes to see if this spot is
+the same as a previous one but for the time spotted" dupe check.
+2. improve the sh/vhftable and sh/hftable commands to allow you to enquire
+by dxcc country (using the relevant prefixes or dxcc country numbers).
+[note to translators, I have changed the help text and Messages tags for
+stat*].
07Oct02=======================================================================
1. fix problem with (invalid) callsigns starting with '0' (zero) eg 0f6ira.
03Oct02=======================================================================
=== 0^SHOW/HFSTATS^Show the HF DX Statistics for last 31 days
Show the HF DX spots breakdown by band for the last 31 days
-=== 0^SHOW/HFTABLE^Show the HF DX Spotter Table for your country
-Show the HF DX Spotter table for your country for the last 31 days
+=== 0^SHOW/HFTABLE [prefix ...]^Show the HF DX Spotter Table
+Show the HF DX Spotter table for the list of prefixes for the last 31 days,
+if there are no prefixes then it will show the table for your country.
+
+Remember that some countries have more than one "DXCC country" in them
+(eg G :-), to show them (assuming you are not in G already which is
+specially treated in the code) you must list all the relevant prefixes
+
+ sh/hftable g gm gd gi gj gw gu
+
+Note that the prefixes are converted into country codes so you don't have
+to list all possible prefixes for each country.
=== 8^SHOW/HOPS <call> [ann|spots|route|wcy|wwv]^Show the hop counts for a node
This command shows the hop counts set up for a node. You can specify
=== 0^SHOW/VHFSTATS^Show the VHF DX Statistics for last 31 days
Show the VHF DX spots breakdown by band for the last 31 days
-=== 0^SHOW/VHFTABLE^Show the VHF DX Spotter Table for your country
-Show the VHF DX Spotter table for your country for the last 31 days
+=== 0^SHOW/VHFTABLE [prefix ...]^Show the VHF DX Spotter Table
+Show the VHF DX Spotter table for the list of prefixes for the last 31 days,
+if there are no prefixes then it will show the table for your country.
+
+Remember that some countries have more than one "DXCC country" in them
+(eg G :-), to show them (assuming you are not in G already which is
+specially treated in the code) you must list all the relevant prefixes
+
+ sh/vhftable g gm gd gi gj gw gu
+
+Note that the prefixes are converted into country codes so you don't have
+to list all possible prefixes for each country.
=== 0^SHOW/WCY^Show last 10 WCY broadcasts
=== 0^SHOW/WCY <n>^Show last <n> WCY broadcasts
my @out;
my @tot;
-push @out, $self->msg('stathf');
-push @out, sprintf "%11s|%6s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|", qw(Date Total 160m 80m 40m 30m 20m 17m 15m 12m 10m);
+push @out, $self->msg('stathf', cldate(time));
+push @out, sprintf "%6s|%6s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|", qw(Date Total 160m 80m 60m 40m 30m 20m 17m 15m 12m 10m);
foreach my $ref (@in) {
my $linetot = 0;
- foreach my $j (3..11) {
+ foreach my $j (4..13) {
$tot[$j] += $ref->[$j];
$tot[0] += $ref->[$j];
$linetot += $ref->[$j];
}
- push @out, join '|', sprintf("%11s|%6d", $ref->[0]->as_string, $linetot), map {$_ ? sprintf("%5d", $_) : ' '} @$ref[3..11], "";
+ my $date = $ref->[0]->as_string;
+ $date =~ s/-\d+$//;
+ push @out, join '|', sprintf("%6s|%6d", $date, $linetot), map {$_ ? sprintf("%5d", $_) : ' '} @$ref[4..13], "";
}
-push @out, join '|', sprintf("%11s|%6d", 'Total', $tot[0]), map {$_ ? sprintf("%5d", $_) : ' '} @tot[3..11], "";
+push @out, join '|', sprintf("%6s|%6d", 'Total', $tot[0]), map {$_ ? sprintf("%5d", $_) : ' '} @tot[4..13], "";
return (1, @out);
my @dxcc;
my $limit = 100;
-push @dxcc, (61..67) if $self->dxcc >= 61 && $self->dxcc < 67;
-push @dxcc, $self->dxcc unless @dxcc;
+if ($line) {
+ my @pref = split /[\s,]+/, $line;
+ push @dxcc, Prefix::to_ciz('nc', @pref);
+ return (1, $self->msg('e27', $line)) unless @dxcc;
+} else {
+ push @dxcc, (61..67) if $self->dxcc >= 61 && $self->dxcc < 67;
+ push @dxcc, $self->dxcc unless @dxcc;
+}
my $now = Julian::Day->new(time())->sub(1);
my %list;
next unless grep $l[2] eq $_, @dxcc;
my $ref = $list{$l[0]} || [0,0,0,0,0,0,0,0,0,0];
my $j = 1;
- foreach my $item (@l[3..11]) {
+ foreach my $item (@l[4..13]) {
$ref->[$j] += $item;
$ref->[0] += $item;
$j++;
my @tot;
my $nocalls;
-push @out, $self->msg('stathft', join(',', @dxcc));
-push @out, sprintf "%10s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|", qw(Callsign Tot 160m 80m 40m 30m 20m 17m 15m 12m 10m);
+push @out, $self->msg('stathft', join(',', @dxcc), cldate(time));
+push @out, sprintf "%10s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s", qw(Callsign Tot 160m 80m 60m 40m 30m 20m 17m 15m 12m 10m);
for (sort {$list{$b}->[0] <=> $list{$a}->[0] || $a cmp $b} keys %list) {
my $ref = $list{$_};
$nocalls++;
my @list = (sprintf "%10s", $_);
- foreach my $j (0..10) {
+ foreach my $j (0..11) {
my $r = $ref->[$j];
if ($r) {
$tot[$j] += $r;
my @out;
my @tot;
-push @out, $self->msg('statvhf');
+push @out, $self->msg('statvhf', cldate(time));
push @out, sprintf "%11s|%6s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|", qw(Date Total 6m 4m 2m 70cm 23cm 13cm 9cm 6cm 3cm);
foreach my $ref (@in) {
my $linetot = 0;
- foreach my $j (12..14,16..21) {
+ foreach my $j (14..16,18..23) {
$tot[$j] += $ref->[$j];
$tot[0] += $ref->[$j];
$linetot += $ref->[$j];
}
- push @out, join('|', sprintf("%11s|%6d", $ref->[0]->as_string, $linetot), map {$_ ? sprintf("%5d", $_) : ' '} @$ref[12..14,16..21]) . '|';
+ push @out, join('|', sprintf("%11s|%6d", $ref->[0]->as_string, $linetot), map {$_ ? sprintf("%5d", $_) : ' '} @$ref[14..16,18..23]) . '|';
}
-push @out, join('|', sprintf("%11s|%6d", 'Total', $tot[0]), map {$_ ? sprintf("%5d", $_) : ' '} @tot[12..14,16..21]) . '|';
+push @out, join('|', sprintf("%11s|%6d", 'Total', $tot[0]), map {$_ ? sprintf("%5d", $_) : ' '} @tot[14..16,18..23]) . '|';
return (1, @out);
my @dxcc;
my $limit = 100;
-push @dxcc, (61..67) if $self->dxcc >= 61 && $self->dxcc < 67;
-push @dxcc, $self->dxcc unless @dxcc;
+if ($line) {
+ my @pref = split /[\s,]+/, $line;
+ push @dxcc, Prefix::to_ciz('nc', @pref);
+ return (1, $self->msg('e27', $line)) unless @dxcc;
+} else {
+ push @dxcc, (61..67) if $self->dxcc >= 61 && $self->dxcc < 67;
+ push @dxcc, $self->dxcc unless @dxcc;
+}
my $now = Julian::Day->new(time())->sub(1);
my %list;
next unless grep $l[2] eq $_, @dxcc;
my $ref = $list{$l[0]} || [0,0,0,0,0,0,0,0,0,0];
my $j = 1;
- foreach my $item (@l[12..14, 16..22]) {
+ foreach my $item (@l[14..16, 18..23]) {
$ref->[$j] += $item;
$ref->[0] += $item;
$j++;
my @tot;
my $nocalls;
-push @out, $self->msg('statvhft', join ',', @dxcc);
+push @out, $self->msg('statvhft', join(',', @dxcc), cldate(time));
push @out, sprintf "%10s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|%4s|", qw(Callsign Tot 6m 4m 2m 70cm 23cm 13cm 9cm 6cm 3cm);
for (sort {$list{$b}->[0] <=> $list{$a}->[0] || $a cmp $b} keys %list) {
}
$s .= "(" . join(' || ', @t) . ")";
} elsif ($fref->[1] =~ /^n[ciz]$/ ) { # for DXCC, ITU, CQ Zone
- my @n;
my $cmd = $fref->[1];
- foreach my $v (@val) {
- if ($v =~ /^\d+$/) {
- push @n, $v unless grep $_ eq $v, @n;
- } else {
- my @pre = Prefix::extract($v);
- return ('numpre', $dxchan->msg('e27', $_)) unless @pre;
- shift @pre;
- foreach my $p (@pre) {
- my $n = $p->dxcc if $cmd eq 'nc' ;
- $n = $p->itu if $cmd eq 'ni' ;
- $n = $p->cq if $cmd eq 'nz' ;
- push @n, $n unless grep $_ eq $n, @n;
- }
- }
- }
- $s .= "(" . join(' || ', map {"\$r->[$fref->[2]]==$_"} @n) . ")";
+ my @pre = Prefix::to_ciz($cmd, @val);
+ return ('numpre', $dxchan->msg('e27', $_)) unless @pre;
+ $s .= "(" . join(' || ', map {"\$r->[$fref->[2]]==$_"} @pre) . ")";
} elsif ($fref->[1] eq 'r') {
my @t;
for (@val) {
sqra => 'Cluster QRA Locator$_[0], DON\'T FORGET TO CHANGE YOUR DXVars.pm',
sorry => 'Sorry',
spf1 => 'spoof: creating new user $_[0]',
- stathf => 'HF DX Spot Stats, last 31 days',
- stathft => 'HF DX Spot Stats, last 31 days for DXCC $_[0]',
- statvhf => 'VHF+ DX Spot Stats, last 31 days',
- statvhft => 'VHF+ DX Spot Stats, last 31 days for DXCC $_[0]',
+ stathf => 'HF DX Spot Stats, last 31 days from $_[0]',
+ stathft => 'HF DX Spot Stats, last 31 days from $_[1] for DXCC $_[0]',
+ statvhf => 'VHF+ DX Spot Stats, last 31 days from $_[0]',
+ statvhft => 'VHF+ DX Spot Stats, last 31 days from $_[1] for DXCC $_[0]',
statdx => 'Total DX Spots last 31 days',
sun => 'Location dd/mm/yyyy Rise Set',
sun_with_azel => 'Location dd/mm/yyyy Rise Set Azim Elev',
return @out;
}
+#
+# turn a list of prefixes / dxcc numbers into a list of dxcc/itu/zone numbers
+#
+# nc = dxcc
+# ni = itu
+# nz = zone
+#
+
+sub to_ciz
+{
+ my $cmd = shift;
+ my @out;
+
+ foreach my $v (@_) {
+ if ($v =~ /^\d+$/) {
+ push @out, $v unless grep $_ eq $v, @out;
+ } else {
+ my @pre = Prefix::extract($v);
+ return () unless @pre;
+ shift @pre;
+ foreach my $p (@pre) {
+ my $n = $p->dxcc if $cmd eq 'nc' ;
+ $n = $p->itu if $cmd eq 'ni' ;
+ $n = $p->cq if $cmd eq 'nz' ;
+ push @out, $n unless grep $_ eq $n, @out;
+ }
+ }
+ }
+ return @out;
+}
+
my %valid = (
lat => '0,Latitude,slat',
long => '0,Longitude,slong',
{
mkdir "$dirprefix", 0777 if !-e "$dirprefix";
$fp = DXLog::new($dirprefix, "dat", 'd');
- $statp = DXLog::new($dirprefix, "cys", 'd');
- system("rm -f $main::data/$dirprefix/2001/*.bys");
+ $statp = DXLog::new($dirprefix, "dys", 'd');
+ system("rm -f $main::data/$dirprefix/200?/*.bys");
+ system("rm -f $main::data/$dirprefix/200?/*.cys");
}
sub prefix
# dump if too old
return 2 if $d < $main::systime - $dupage;
-
+
+ # turn the time into minutes (should be already but...)
+ $d = int ($d / 60);
+ $d *= 60;
+
$freq = sprintf "%.1f", $freq; # normalise frequency
$call = substr($call, 0, 12) if length $call > 12;
chomp $text;
my $date = shift;
my $in = $fp->open($date);
my $out = $statp->open($date, 'w');
- my @freq = (
- [0, Bands::get_freq('160m')],
- [1, Bands::get_freq('80m')],
- [2, Bands::get_freq('40m')],
- [3, Bands::get_freq('30m')],
- [4, Bands::get_freq('20m')],
- [5, Bands::get_freq('17m')],
- [6, Bands::get_freq('15m')],
- [7, Bands::get_freq('12m')],
- [8, Bands::get_freq('10m')],
- [9, Bands::get_freq('6m')],
- [10, Bands::get_freq('4m')],
- [11, Bands::get_freq('2m')],
- [12, Bands::get_freq('220')],
- [13, Bands::get_freq('70cm')],
- [14, Bands::get_freq('23cm')],
- [15, Bands::get_freq('13cm')],
- [16, Bands::get_freq('9cm')],
- [17, Bands::get_freq('6cm')],
- [18, Bands::get_freq('3cm')],
- [19, Bands::get_freq('12mm')],
- [20, Bands::get_freq('6cm')],
- );
+ my @freq;
my %list;
my @tot;
if ($in && $out) {
+ my $i = 0;
+ @freq = map {[$i++, Bands::get_freq($_)]} qw(136khz 160m 80m 60m 40m 30m 20m 17m 15m 12m 10m 6m 4m 2m 220 70cm 23cm 13cm 9cm 6cm 3cm 12mm 6mm);
while (<$in>) {
chomp;
my ($freq, $by, $dxcc) = (split /\^/)[0,4,6];
}
}
- my $i;
for ($i = 0; $i < @freq+2; $i++) {
$tot[$i] ||= 0;
}