From 5b9ab81174d4a7734c92af52da6ddf89e980e321 Mon Sep 17 00:00:00 2001 From: minima Date: Sat, 12 Oct 2002 23:04:56 +0000 Subject: [PATCH] fix the last 5 minute dups add DXCC chosing to sh/vhftable and sh/hftable --- Changes | 7 +++++++ cmd/Commands_en.hlp | 28 ++++++++++++++++++++++++---- cmd/show/hfstats.pl | 12 +++++++----- cmd/show/hftable.pl | 18 ++++++++++++------ cmd/show/vhfstats.pl | 8 ++++---- cmd/show/vhftable.pl | 14 ++++++++++---- perl/Filter.pm | 20 +++----------------- perl/Messages | 8 ++++---- perl/Prefix.pm | 31 +++++++++++++++++++++++++++++++ perl/Spot.pm | 38 +++++++++++--------------------------- 10 files changed, 113 insertions(+), 71 deletions(-) diff --git a/Changes b/Changes index 59458297..e6cab461 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,10 @@ +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======================================================================= diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp index 41ec1441..4058c8c7 100644 --- a/cmd/Commands_en.hlp +++ b/cmd/Commands_en.hlp @@ -1763,8 +1763,18 @@ all the filters set - for all the various categories. === 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 [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 @@ -2014,8 +2024,18 @@ the prefixes or callsigns that you 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 ^Show last WCY broadcasts diff --git a/cmd/show/hfstats.pl b/cmd/show/hfstats.pl index 63a3b56c..547882d1 100644 --- a/cmd/show/hfstats.pl +++ b/cmd/show/hfstats.pl @@ -35,17 +35,19 @@ for ($i = 0; $i < $days; $i++) { 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); diff --git a/cmd/show/hftable.pl b/cmd/show/hftable.pl index abd04b00..c7fee473 100644 --- a/cmd/show/hftable.pl +++ b/cmd/show/hftable.pl @@ -13,8 +13,14 @@ my $days = 31; 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; @@ -34,7 +40,7 @@ for ($i = 0; $i < $days; $i++) { 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++; @@ -48,14 +54,14 @@ my @out; 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; diff --git a/cmd/show/vhfstats.pl b/cmd/show/vhfstats.pl index b3f1a078..b3584b59 100644 --- a/cmd/show/vhfstats.pl +++ b/cmd/show/vhfstats.pl @@ -35,17 +35,17 @@ for ($i = 0; $i < $days; $i++) { 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); diff --git a/cmd/show/vhftable.pl b/cmd/show/vhftable.pl index 61193a84..d41838f6 100644 --- a/cmd/show/vhftable.pl +++ b/cmd/show/vhftable.pl @@ -13,8 +13,14 @@ my $days = 31; 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; @@ -34,7 +40,7 @@ for ($i = 0; $i < $days; $i++) { 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++; @@ -48,7 +54,7 @@ my @out; 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) { diff --git a/perl/Filter.pm b/perl/Filter.pm index bf7ff65c..66c3ff7a 100644 --- a/perl/Filter.pm +++ b/perl/Filter.pm @@ -490,24 +490,10 @@ sub parse } $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) { diff --git a/perl/Messages b/perl/Messages index 463a048d..3829d2eb 100644 --- a/perl/Messages +++ b/perl/Messages @@ -255,10 +255,10 @@ package DXM; 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', diff --git a/perl/Prefix.pm b/perl/Prefix.pm index 10559711..246dbb65 100644 --- a/perl/Prefix.pm +++ b/perl/Prefix.pm @@ -363,6 +363,37 @@ L1: for ($n = 0; $n < @parts; $n++) { 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', diff --git a/perl/Spot.pm b/perl/Spot.pm index 2863a449..9b67cc5f 100644 --- a/perl/Spot.pm +++ b/perl/Spot.pm @@ -97,8 +97,9 @@ sub init { 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 @@ -303,7 +304,11 @@ sub dup # 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; @@ -332,33 +337,13 @@ sub genstats($) 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]; @@ -375,7 +360,6 @@ sub genstats($) } } - my $i; for ($i = 0; $i < @freq+2; $i++) { $tot[$i] ||= 0; } -- 2.34.1