From: Dirk Koopman Date: Wed, 15 Feb 2017 22:50:34 +0000 (+0000) Subject: Merge branch 'mojo' of ssh://server/scm/spider into mojo X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=c80c2aab681f6f691f7b9a5fa76cde2e938562c0;hp=e57c3e3573db848a474524fbe9723dea52e151a1;p=spider.git Merge branch 'mojo' of ssh://server/scm/spider into mojo Conflicts: Changes perl/cluster.pl --- diff --git a/Changes b/Changes index 13fa2e16..ac17a93f 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +15Feb17======================================================================= +1. Update UPGRADE.mojo a bit +2. Add local::lib so that it can be used for non-root installations. 09Jan17======================================================================= 1. Fix mojo branch clean install issues (failing to find $main::data et al) 02Jan17======================================================================= diff --git a/UPGRADE.mojo b/UPGRADE.mojo index 378b943f..c6d3d339 100644 --- a/UPGRADE.mojo +++ b/UPGRADE.mojo @@ -11,7 +11,7 @@ the node. I am also using a modern, event driven, web socket "manager" called Mo which is considerably more efficient than what went before (but is not necessary for small nodes). There are some 200-400 user nodes out there that will definitely see the difference in terms of both CPU usage and general responsiveness. Using Mojolicious also brings the -tantalising possibility of grafting on a web frontend, as it where, to the "side" of a +tantalising possibility of grafting on a web frontend, as it were, to the "side" of a DXSpider node. But serious work on this won't start until we have a stable base to work on. Apart from anything else there will, almost certainly, need to be some internal data structure reorganisation before a decent web frontend could be constructed. @@ -42,6 +42,8 @@ Prerequisites: Install cpamminus: sudo apt-get install cpanminus +or + wget -O - https://cpanmin.us | perl - --sudo App::cpanminus or sudo apt-get install curl curl -L https://cpanmin.us | perl - --sudo App::cpanminus diff --git a/perl/cluster.pl b/perl/cluster.pl index 4aa81c62..054a22ca 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -21,6 +21,12 @@ use vars qw($root $is_win $systime); BEGIN { umask 002; + # take into account any local::lib that might be present + eval { + require local::lib; + }; + import local::lib unless ($@); + # root of directory tree for this system $root = "/spider"; $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'}; @@ -69,7 +75,7 @@ use DXVars; use SysVar; use strict; - + use Mojo::IOLoop; use Msg; diff --git a/perl/rbn.pl b/perl/rbn.pl index eb2c743e..8438b8e6 100755 --- a/perl/rbn.pl +++ b/perl/rbn.pl @@ -25,29 +25,34 @@ my $wantcw = 1; my $wantrtty = 1; my $wantpsk = 1; my $wantbeacon = 1; +my $wantdx = 1; +my $wantraw = 0; my $showrbn; my $help = 0; my $man = 0; my $mycall; +#Getopt::Long::Configure( qw(auto_abbrev) ); GetOptions('host=s' => \$host, 'port=i' => \$port, 'debug' => \$dbg, 'rbn' => \$showrbn, 'stats' => \$showstats, - 'repeattime=i' => sub { $minspottime = $_[1] * 60 }, + 'raw' => \$wantraw, + 'repeattime|rt=i' => sub { $minspottime = $_[1] * 60 }, 'want=s' => sub { my ($name, $value) = @_; - $wantcw = $wantrtty = $wantpsk = $wantbeacon = 0; + $wantcw = $wantrtty = $wantpsk = $wantbeacon = $wantdx = 0; for (split /[:,\|]/, $value) { ++$wantcw if /^cw$/i; ++$wantpsk if /^psk$/i; ++$wantrtty if /^rtty$/i; ++$wantbeacon if /^beacon$/i; + ++$wantdx if /^dx$/i; } }, 'help|?' => \$help, - man => \$man, + 'man' => \$man, '<>' => sub { $mycall = shift }, ) or pod2usage(2); @@ -58,7 +63,7 @@ pod2usage(-exitval => 0, -verbose => 2) if $man; for ($attempts = 1; $attempts <= 5; ++$attempts) { - say "admin,connecting to $host $port.. (attempt $attempts) " if $dbg; + say "ADMIN,connecting to $host $port.. (attempt $attempts) " if $dbg; $sock = IO::Socket::IP->new( PeerHost => $host, PeerPort => $port, @@ -67,10 +72,10 @@ for ($attempts = 1; $attempts <= 5; ++$attempts) { last if $sock; } -die "admin,Cannot connect to $host:$port after 5 attempts $!" unless $sock; -say "admin,connected" if $dbg; -print $sock "$mycall\r\n"; -say "admin,call sent" if $dbg; +die "ADMIN,Cannot connect to $host:$port after 5 attempts $!" unless $sock; +say "ADMIN,connected" if $dbg; +#print $sock "$mycall\r\n"; +#say "ADMIN,call $mycall sent" if $dbg; my %d; my %spot; @@ -85,8 +90,15 @@ while (<$sock>) { my $tim = time; # parse line - my (undef, undef, $origin, $qrg, $call, $mode, $s, $m, $spd, $u, $sort, $t) = split /[:\s]+/; - if ($t) { + say "RAW,$_" if $wantraw; + + if (/call:/) { +print $sock "$mycall\r\n"; +say "ADMIN,call $mycall sent" if $dbg; + } + + my (undef, undef, $origin, $qrg, $call, $mode, $s, $m, $spd, $u, $sort, $t, $tx) = split /[:\s]+/; + if ($t || $tx) { # We have an RBN data line, dedupe it very simply on time, ignore QRG completely. # This works because the skimmers are NTP controlled (or should be) and will receive @@ -95,11 +107,21 @@ while (<$sock>) { ++$noraw; next if $d{$p}; + # fix up times for things like 'NXDXF B' etc + if ($tx && $t != /^\d{4}Z$/) { + if ($tx =~ /^\d{4}Z$/) { + $t = $tx; + } else { + say "ERR,$_"; + next; + } + } + # new RBN input $d{$p} = $tim; ++$norbn; $qrg = sprintf('%.1f', nearest(.1, $qrg)); # to nearest 100Hz (to catch the odd multiple decpl QRG [eg '7002.07']). - say join(',', "RBN", $origin, $qrg, $call, $mode, $s, $m, $spd, $u, $sort, $t) if $dbg || $showrbn; + say join(',', "RBN", $origin, $qrg, $call, $mode, $s, $m, $spd, $u, $sort, $t) if !$wantraw && ($dbg || $showrbn); # Determine whether to "SPOT" it based on whether we have not seen it before (near this QRG) or, # if we have, has it been a "while" since the last time we spotted it? If it has been spotted @@ -117,6 +139,7 @@ while (<$sock>) { goto periodic if !$wantcw && $mode =~ /^CW/; goto periodic if !$wantrtty && $mode =~ /^RTTY/; goto periodic if !$wantpsk && $mode =~ /^PSK/; + goto periodic if !$wantdx && $mode =~ /^DX/; } ++$nospot; @@ -125,7 +148,7 @@ while (<$sock>) { $spot{$sp} = $tim; } } else { - say "data,$_" if $dbg; + say "DATA,$_" if $dbg && !$wantraw; } periodic: @@ -142,7 +165,7 @@ while (<$sock>) { ++$count; } } - say "admin,rbn cache: $removed removed $count remain" if $dbg; + say "ADMIN,rbn cache: $removed removed $count remain" if $dbg; $count = $removed = 0; while (my ($k,$v) = each %spot) { if ($tim-$v > $minspottime*2) { @@ -152,7 +175,7 @@ while (<$sock>) { ++$count; } } - say "admin,spot cache: $removed removed $count remain" if $dbg; + say "ADMIN,spot cache: $removed removed $count remain" if $dbg; say join(',', "STAT", $noraw, $norbn, $nospot) if $showstats; $noraw = $norbn = $nospot = 0; @@ -195,9 +218,9 @@ As default, this program will connect to C. Use this a As default, this program will connect to port 7000. Use this argument to change that to some other port. -=item B<-want>=cw,rtty,psk,beacon +=item B<-want>=cw,rtty,psk,beacon,dx -The program will print all spots in all classes [cw, rtty, psk, beacon]. You can choose one or more of +The program will print all spots in all classes in the 'mode/calling' column [cw, rtty, psk, beacon, dx]. You can choose one or more of these classes if you want specific types of spots. =item B<-stats> @@ -215,6 +238,10 @@ but with a RESPOT tag instead. Set this argument to 0 (or less) if you do not wa Show the de-duplicated RBN lines as they come in. +=item B<-raw> + +Show the raw RBN lines as they come in. + =back =head1 DESCRIPTION @@ -234,5 +261,17 @@ Like this: SPOT,SK3W-#,3600.0,OK0EN,CW,13,dB,11,WPM,BEACON,2152Z STAT,263,64,27 +If the -raw flag is set then these lines will be interspersed with the raw line from the RBN source, prefixed +with "RAW,". For example: + + RAW,DX de PJ2A-#: 14025.4 IP0TRC CW 16 dB 31 WPM CQ 1307Z + RAW,DX de PJ2A-#: 10118.9 K1JD CW 2 dB 28 WPM CQ 1307Z + RAW,DX de K2PO-#: 1823.4 HL5IV CW 8 dB 22 WPM CQ 1307Z + SPOT,K2PO-#,1823.4,HL5IV,CW,8,dB,22,WPM,CQ,1307Z + RAW,DX de LZ7AA-#: 14036.6 HA8GZ CW 7 dB 27 WPM CQ 1307Z + RAW,DX de DF4UE-#: 14012.0 R7KM CW 32 dB 33 WPM CQ 1307Z + RAW,DX de G7SOZ-#: 14012.2 R7KM CW 17 dB 31 WPM CQ 1307Z + + =cut