From 25270ac4d9d486c2749515c8b8f32e223d4f38b7 Mon Sep 17 00:00:00 2001 From: minima Date: Mon, 10 Mar 2003 23:37:10 +0000 Subject: [PATCH] add create --- perl/create_qsl.pl | 74 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 perl/create_qsl.pl diff --git a/perl/create_qsl.pl b/perl/create_qsl.pl new file mode 100755 index 00000000..b3e514de --- /dev/null +++ b/perl/create_qsl.pl @@ -0,0 +1,74 @@ +#!/usr/bin/perl +# +# Implement a 'GO' database list +# +# Copyright (c) 2003 Dirk Koopman G1TLH +# +# $Id$ +# + +# search local then perl directories +BEGIN { + use vars qw($root); + + # 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 strict; + +use IO::File; +use DXVars; +use DXUtil; +use Spot; +use QSL; + +use vars qw($end $lastyear $lastday $lasttime); + +$end = 0; +$SIG{TERM} = $SIG{INT} = sub { $end++ }; + +my $qslfn = "qsl"; + +$main::systime = time; + +unlink "$root/data/qsl.v1"; + +QSL::init(1) or die "cannot open QSL file"; + +my $base = "$root/data/spots"; + +opendir YEAR, $base or die "$base $!"; +foreach my $year (sort readdir YEAR) { + next if $year =~ /^\./; + + my $baseyear = "$base/$year"; + opendir DAY, $baseyear or die "$baseyear $!"; + foreach my $day (sort readdir DAY) { + next unless $day =~ /(\d+)\.dat$/; + my $dayno = $1 + 0; + + my $fn = "$baseyear/$day"; + my $f = new IO::File $fn or die "$fn ($!)"; + print "doing: $fn\n"; + while (<$f>) { + if (/(QSL|VIA)/i) { + my ($freq, $call, $t, $comment, $by, @rest) = split /\^/; + my $q = QSL::get($call) || new QSL $call; + $q->update($comment, $t, $by); + $lasttime = $t; + } + } + $f->close; + } +} + +QSL::finish(); + +exit(0); + + -- 2.43.0