2 # Show total HF DX Spot Stats per day
4 # Copyright (c) 2001 Dirk Koopman G1TLH
8 # Modified on 2002/10/29 by K1XX for his own use
13 # sh/hfstats <date> <no. of days>
15 # Known good data formats
17 # 24-Nov-02 (using - . or / as separator)
20 # 11/24/02 (using - . or / as separator)
28 my ($self, $line) = @_;
29 my @f = split /\s+/, $line;
32 my $date = cldate($main::systime);
33 my $utime = $main::systime;
39 if ($f =~ /^\d+$/ && $f < 366) { # no of days
43 if (my $ut = Date::Parse::str2time($f)) { # is it a parseable date?
47 push @out, $self->msg('e33', $f);
50 return (1, @out) if @out;
52 $now = Julian::Day->new($utime);
53 $now = $now->sub($days);
54 $date = cldate($utime);
56 @out = $self->spawn_cmd("show/hfstats $line", sub {
61 # generate the spot list
62 for ($i = 0; $i < $days; $i++) {
63 my $fh = $Spot::statp->open($now); # get the next file
66 $fh = $Spot::statp->open($now);
71 next unless $l[0] eq 'TOTALS';
82 push @out, $self->msg('stathf', $date, $days);
83 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);
84 foreach my $ref (@in) {
86 foreach my $j (4..13) {
87 $tot[$j] += $ref->[$j];
88 $tot[0] += $ref->[$j];
89 $linetot += $ref->[$j];
91 my $date = $ref->[0]->as_string;
93 push @out, join '|', sprintf("%6s|%6d", $date, $linetot), map {$_ ? sprintf("%5d", $_) : ' '} @$ref[4..13], "";
95 push @out, join '|', sprintf("%6s|%6d", 'Total', $tot[0]), map {$_ ? sprintf("%5d", $_) : ' '} @tot[4..13], "";