From 2520521008cdb3c5ab168c678c57130be712daee Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Sun, 31 May 2020 11:43:39 +0100 Subject: [PATCH] improve links cmd. fix UPGRADE.mojo --- Changes | 8 ++++---- UPGRADE.mojo | 4 ++-- cmd/links.pl | 8 +++++--- perl/DXUtil.pm | 13 ++++++------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Changes b/Changes index 50788fd9..4d161b00 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +31May20======================================================================= +1. Improve links command layout slightly. +2. Issue an *accurate* UPGRADE.mojo with all the new packages included! 30May20======================================================================= 1. Fix sh/dx! It appears that there is a long standing problem with sh/dx not actually return all the answers it should. I have also had a request to @@ -14,10 +17,7 @@ 29May20======================================================================= 1. Please install Math::Round and Data::Structure::Util. Instructions are available in UPGRADE.mojo. -2. Notwithstanding item 1 below. I have decided to keep DB_File but ditch - Storable. The current users.v3 will be converted, automatically, to - users.v3j on startup. After this is done a 'user_json' file (the - replacement for 'user_asc') will also be generated. +2. ** Withdrawn ** user file format change to json not yet committed. 20May20======================================================================= 1. Backport convert-users-v3-to-v4.pl to allow creation of the new json formatted *text* based user file from the old v3 DB_File and Storable diff --git a/UPGRADE.mojo b/UPGRADE.mojo index 5e5a402e..c42313dc 100644 --- a/UPGRADE.mojo +++ b/UPGRADE.mojo @@ -56,7 +56,7 @@ You will need the following CPAN packages: If you are on a Debian based system (Devuan, Ubuntu, Mint etc) that is reasonably new (I use Ubuntu 18.04 and Debian 10) then you can simply do: - sudo apt-get install libev-perl libmojolicious-perl libjson-perl libjson-xs-perl libdata-structure-util-perl + sudo apt-get install libev-perl libmojolicious-perl libjson-perl libjson-xs-perl libdata-structure-util-perl libmath-round-perl or on Redhat based systems you can install the very similarly (but not the same) named packages. I don't the exact names but using anything less than Centos 7 is likely to cause @@ -68,7 +68,7 @@ You will need the following CPAN packages: sudo apt-get install build-essential. - sudo cpanm EV Mojolicious JSON JSON::XS Data::Structure::Util + sudo cpanm EV Mojolicious JSON JSON::XS Data::Structure::Util Math::Round # just in case it's missing sudo apt-get install top diff --git a/cmd/links.pl b/cmd/links.pl index f3554557..641f977b 100644 --- a/cmd/links.pl +++ b/cmd/links.pl @@ -18,9 +18,10 @@ my $nowt = time; push @out, " Ave Obs Ping Next Filters"; push @out, " Callsign Type Started Uptime RTT Count Int. Ping Iso? In Out PC92? Address"; -foreach $dxchan ( sort {$a->call cmp $b->call} DXChannel::get_all_nodes ) { - my $call = $dxchan->call(); +foreach $dxchan ( sort {$a->call cmp $b->call} DXChannel::get_all ) { next if $dxchan == $main::me; + next unless $dxchan->is_node || $dxchan->is_rbn; + my $call = $dxchan->call(); my $t = cldatetime($dxchan->startt); my $sort; my $name = $dxchan->user->name || " "; @@ -44,7 +45,7 @@ foreach $dxchan ( sort {$a->call cmp $b->call} DXChannel::get_all_nodes ) { } unless ($pingint) { $lastt = 0; - $ping = " "; + $ping = " "; } $sort = "DXSP" if $dxchan->is_spider; @@ -52,6 +53,7 @@ foreach $dxchan ( sort {$a->call cmp $b->call} DXChannel::get_all_nodes ) { $sort = "DXNT" if $dxchan->is_dxnet; $sort = "AR-C" if $dxchan->is_arcluster; $sort = "AK1A" if $dxchan->is_ak1a; + $sort = "RBN " if $dxchan->is_rbn; my $ipaddr; my $addr = $dxchan->hostname; diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm index e77eb294..e93d7ab4 100644 --- a/perl/DXUtil.pm +++ b/perl/DXUtil.pm @@ -386,7 +386,7 @@ sub is_callsign (?:\d?[A-Z]{1,2}\d*/)? # out of area prefix / (?:\d?[A-Z]{1,2}\d+) # main prefix one (required) [A-Z]{1,5} # callsign letters (required) - (?:-(?:\d{1,2}|\#))? # - nn possibly (eg G8BPQ-8) or -# (an RBN spot) + (?:-(?:\d{1,2}))? # - nn possibly (eg G8BPQ-8) (?:/[0-9A-Z]{1,7})? # / another prefix, callsign or special label (including /MM, /P as well as /EURO or /LGT) possibly $!x; @@ -554,15 +554,14 @@ sub difft $t -= $d * 86400; $h = int $t / 3600; $out .= sprintf ("%s${h}h", $adds?' ':'') if $h; -# $out .= "${h}h" if $h || $d; $t -= $h * 3600; $m = int $t / 60; $out .= sprintf ("%s${m}m", $adds?' ':'') if $m; -# $out .= "${m}m" if $m || $h || $d; - $s = int $t % 60; - $out .= sprintf ("%s${s}s", $adds?' ':'') if $s; - # $out .= "${s}s"; - $out ||= sprintf ("%s0s", $adds?' ':''); + if ($d == 0 && $adds || $adds == 2) { + $s = int $t % 60; + $out .= sprintf ("%s${s}s", $adds?' ':'') if $s; + $out ||= sprintf ("%s0s", $adds?' ':''); + } return $out; } -- 2.43.0