X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fdxoldtonew.pl;h=3a2491f8c1ba79ae3c63f1f413b9bee1e234b620;hb=refs%2Fheads%2Fnew-spawn;hp=d850ad2e7b9290ff778e3b0304465dae04494fd6;hpb=21e7642d216656c60b164d76208633a0c81cf5db;p=spider.git diff --git a/perl/dxoldtonew.pl b/perl/dxoldtonew.pl index d850ad2e..3a2491f8 100755 --- a/perl/dxoldtonew.pl +++ b/perl/dxoldtonew.pl @@ -1,30 +1,56 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # -# convert an Ak1a DX.DAT file to comma delimited form +# convert an AK1A DX.DAT file to comma delimited form # +# PLEASE BE WARNED: +# +# This routine is really designed for archive data. It will create and add to +# standard DXSpider spot files. If those spot files already exist (because you +# were running DXSpider at the same time as collecting this 'old' data) then +# this will simply append the data onto the end of the appropriate spot file +# for that day. This may then give strange 'out of order' results when viewed +# with the show/dx command +# +# +# +# Copyright (c) 1998-2003 Dirk Koopman G1TLH # -use Date::Parse; +# search local then perl directories +BEGIN { + # root of directory tree for this system + $root = "/spider"; + $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'}; + + unshift @INC, "$root/perl"; # this IS the right way round! + unshift @INC, "$root/local"; +} + +use DXUtil; use Spot; +use Prefix; + +$ifn = "$root/data/DX.DAT"; +$ifn = shift if @ARGV; +print "Using: $ifn as input... \n"; -sysopen(IN, "../data/DX.DAT", 0) or die "can't open DX.DAT ($!)"; -open(OUT, ">../data/dxcomma") or die "can't open dxcomma ($!)"; +sysopen(IN, $ifn, 0) or die "can't open $ifn ($!)"; -system("rm -rf $Spot::prefix"); -Spot->init(); +Prefix::init(); +Spot::init(); while (sysread(IN, $buf, 86)) { ($freq,$call,$date,$time,$comment,$spotter) = unpack 'A10A13A12A6A31A14', $buf; - $date =~ s/^\s*(\d+)-(\w\w\w)-(19\d\d)$/$1 $2 $3/og; - $time =~ s/^(\d\d)(\d\d)Z$/$1:$2 +0000/; - $d = str2time("$date $time"); +# printf "%-13s %10.1f %s %s by %s %s\n", $call, $freq, $date, $time, $spotter, $comment; + + $dt = cltounix($date, $time); $comment =~ s/^\s+//o; - if ($d) { - Spot->new($freq, $call, $d, $comment, $spotter); + if ($dt ) { + my @spot = Spot::prepare($freq, $call, $dt, $comment, $spotter); + Spot::add(@spot); } else { - print "$call $freq $date $time\n"; + print "ERROR: $call $freq $date $time by $spotter $comment\n"; } } close(IN); -close(OUT);