Browse Source

LoTW: Download report directly from lotw.arrl.org. Update DXCC stuff. Prepare for release 0.4.0

master
Fabian Kurz 4 years ago
parent
commit
9b3bcb8327
  1. 3
      AUTHORS
  2. 7
      CHANGELOG
  3. 7
      INSTALL
  4. 2
      Makefile
  5. 2
      RELEASENOTES
  6. 8
      config
  7. 4198
      cty.dat
  8. 38
      doc/index.html
  9. 6
      yfk
  10. 92
      yfksubs.pl

3
AUTHORS

@ -1,3 +1,4 @@
Fabian Kurz, DJ1YFK <mail@fkurz.net>
Fabian Kurz, DJ1YFK <fabian@fkurz.net>
Wes Hardaker, WS6Z <wes AT TA ws6z DOTTY com> for misc minor improvements
Cornell Gonschior, DF6FR <df6fr@darc.de> also for minor improvements
David Quental, CT1DRB contributed some fixes

7
CHANGELOG

@ -1,3 +1,10 @@
2019-Jun-30: Version 0.4.0
-------------------------------------------------------------------------------
- Many small improvements contributed over the years, mostly by DF6FR and CT1DRB
- Add support for LoTW upload and download directy from YFKlog (requires tqsl)
- Update dxcc algorithm to handle "new" style country files (with full calls
marked with a =).
2008-Jan-31: Version 0.3.5
-------------------------------------------------------------------------------
- Remote logging from fldigi; uses the same interface as Xlog.

7
INSTALL

@ -1,14 +1,13 @@
YFKlog 0.3.6 INSTALLATION GUIDE
YFKlog 0.4.0 INSTALLATION GUIDE
--------------------------------
More detailled instructions at http://fkurz.net/ham/yfklog/doc/
--------------------------------
YFKlog 0.3.6 comes with a PERL Makefile.
YFKlog 0.4.0 comes with a Makefile
$ perl Makefile.PL [PREFIX=/usr/local]
# (sudo) make install
$ (sudo) make install [PREFIX=/usr/local]
will install it into PREFIX (default /usr/[bin|share/yfklog/]).

2
Makefile

@ -1,4 +1,4 @@
VERSION=0.3.6
VERSION=0.4.0
DESTDIR ?= /usr

2
RELEASENOTES

@ -1,4 +1,4 @@
RELEASENOTES for YFKlog 0.3.5
RELEASENOTES for YFKlog 0.4.0
==============================
To update from an older version, just replace all files of the old

8
config

@ -190,10 +190,10 @@ askme=1
logsort=C
# (O) prevsort: How to sort the display of previous QSOs for a certain call
# D = By date, Descending
# A = By date, ascending. (default)
# D = By date, descending (default)
# A = By date, ascending
prevsort=A
prevsort=D
# (O) browser: A browser to do QRZ.com call lookups.
@ -208,5 +208,3 @@ colors=1
# fill in QSO information with FCC and/or QRZ lookup information
#
usehamdb=0

4198
cty.dat

File diff suppressed because it is too large Load Diff

38
doc/index.html

@ -82,6 +82,21 @@ and functions of YFKlog.</p>
<hr>
<h2><a id="install" name="install">1. Installation</a></h2>
<p>Install the required packages:</p>
<ul>
<li>Perl</li>
<li>DBI</li>
<li>SQLite</li>
<li>ncurses</li>
<li>Make</li>
</ul>
<p>On Ubuntu or Debian Linux, you can satisfy all requirements simply by
running:</p>
<code>sudo apt-get install perl libdbd-sqlite3-perl libclass-dbi-sqlite-perl
make
libsqlite3-0 libcurses-perl</code>
<p>Download the <a href="http://fkurz.net/ham/yfklog/">latest version</a> of
YFKlog and unpack the tarball to a directory of your choice, then run
<code>make install</code>.</p>
@ -274,14 +289,14 @@ they are not important.</p>
<li><strong>prevsort</strong> - The sort order of the display of the
previous QSOs with a certain station. By date, either
<strong>A</strong> for ascending or <strong>D</strong> for descending.
Default: Ascending.
Default: Descending.
</li>
<li><strong>browser</strong> - Browser for QRZ.com lookups. (Default: dillo) </li>
<li><strong>lotwlocation</strong> - List of station locations for LoTW</li>
<li><strong>lotwuser</strong> - LoTW web user name to download reports</li>
<li><strong>lotwpass</strong> - LoTW web password</li>
</ul>
<hr>
@ -619,8 +634,7 @@ Name/QTH DB" from the main menu.</p>
<h2><a id="lotw" name="lotw">12. LoTW functions</a></h2>
<p>YFKlog makes it easy to keep track with the LoTW status of your QSOs and
upload data to LoTW.</p>
<p>YFKlog makes it easy to keep track with the LoTW status of your QSOs!</p>
<p>For each QSO, YFKlog saves a value (called QSLrL, QSL-received-LoTW), which
can be:
@ -640,7 +654,8 @@ file, and changes these QSOs to <em>R</em> (requested). The ADIF file can
then be signed with tQSL and uploaded to LoTW or signed and uploaded
automatically.</p>
<p>For uploading directly with <code>tqsl</code> you need to specify at least
<p>For uploading directly with <code>tqsl</code> (which needs to be fully set
up and working on your PC before you can use it from YFKlog) you need to specify at least
one station location in the configuration value <code>lotwlocation</code> for
each callsign. An example value would be:
<pre>lotwlocation=DJ1YFK:Rheine,DJ1YFK:Dresden,DJ1YFK:Munich,SO5CW:Warka</pre>
@ -648,11 +663,14 @@ which defines three station locations for DJ1YFK and one for SO5CW. Once you
have exported the ADIF data for LoTW, YFKlog will ask you if you would like to
sign and upload the file; you can select one of the defined station locations.</p>
<h3>12.2 LoTW import</h3>
<h3>12.2 LoTW import / download</h3>
<p>Received QSL records from LoTW can be downloaded via the LoTW web-interface,
under "Your QSOs" &rarr; "Download report". A file called
<code>lotwreport.adi</code> is generated, which contains all confirmations, by
default since the last download of this file.</p>
under "Your QSOs" &rarr; "Download report" or downloaded by YFKlog (for this
to work you need to set your LoTW account username and password in your config
file).
The file downloaded from LoTW, called <code>lotwreport.adi</code>, contains all
new confirmations since your last download.</p>
<p>This file may contain QSL records for <em>one or several</em> of your
callsigns, and can be imported to YFKlog via "Import from LoTW" in the main

6
yfk

@ -4,7 +4,7 @@
# yfklog - a general purpose ham radio logbook
#
# Copyright (C) 2005 Fabian Kurz, DJ1YFK
# Copyright (C) 2005-2019 Fabian Kurz, DJ1YFK
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -36,8 +36,8 @@ if (-f './yfk' && -f './yfksubs.pl' && -f 'THANKS') {
}
import yfksubs;
our $yfkver = '0.3.6'; # Program Version
our $VERSION = '0.3.6'; # XXX
our $yfkver = '0.4.0'; # Program Version
our $VERSION = '0.4.0'; # XXX
# Here we give some variables their default values. Some of them will be
# changed later when reading the config-file .yfklog.

92
yfksubs.pl

@ -4,7 +4,7 @@
# Several subroutines for yfklog, a amateur radio logbook software
#
# Copyright (C) 2005-2009 Fabian Kurz, DJ1YFK
# Copyright (C) 2005-2019 Fabian Kurz, DJ1YFK
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -33,7 +33,8 @@ preparelabels labeltex emptyqslqueue adifexport ftpupload adifimport getlogs
changemycall newlogtable oldlogtable choseeditqso geteditqso editw updateqso checkdate
awards statistics qslstatistics editdb editdbw savedbedit lotwimport
databaseupgrade xplanet queryrig tableexists changeconfig readsubconfig
connectdb connectrig jumpfield receive_qso tqslsign getlotwlocations);
connectdb connectrig jumpfield receive_qso tqslsign getlotwlocations
getlotwstartdate downloadlotw);
use strict;
use POSIX; # needed for acos in distance/direction calculation
@ -42,6 +43,7 @@ use Net::FTP;
use IO::Socket;
use DBI;
use IPC::SysV qw(IPC_PRIVATE IPC_RMID IPC_NOWAIT IPC_CREAT);
use LWP::UserAgent ();
my $havehamdb = eval "require Ham::Callsign::DB;";
my $hamdb;
@ -95,10 +97,12 @@ my @fieldorder = split(/\s+/, $fieldorder);
our $usehamdb = 0;
our $askme=0; # ask before clearing QSOs etc
our $logsort="N"; # Order of log display
our $prevsort="A"; # Order of prev. QSOs
our $prevsort="D"; # Order of prev. QSOs
our $browser='dillo';
our $hamlibtcpport = 4532;
our $lotwlocation=""; # LoTW station locations in format: CALL:location,CALL:location
our $lotwuser=""; # Username for automatic LoTW download
our $lotwpass=""; # Password for automatic LoTW download
# We read the configuration file .yfklog.
@ -218,6 +222,12 @@ while (defined (my $line = <CONFIG>)) { # Read line into $line
elsif ($line =~ /^lotwlocation=(.+)/) {
$lotwlocation = $1;
}
elsif ($line =~ /^lotwuser=(.+)/) {
$lotwuser= $1;
}
elsif ($line =~ /^lotwpass=(.+)/) {
$lotwpass = $1;
}
}
close CONFIG; # Configuration read.
@ -261,7 +271,7 @@ sub connectrig {
}
# Now we read cty.dat from K1EA, or exit when it's not found.
# Now we read cty.dat or exit when it's not found.
my $ctydat = "$prefix/share/yfklog/cty.dat";
if (-R "./cty.dat") {
$ctydat = "./cty.dat";
@ -270,6 +280,7 @@ if (-R "./cty.dat") {
open CTY, "$ctydat" or die "$ctydat not found.".
"Please download it from http://country-files.com/\n";
my %fullcalls; # hash of full calls (=DL1XYZ)
my %prefixes; # hash of arrays main prefix -> (all, prefixes,..)
my %dxcc; # hash of arrays main prefix -> (CQZ, ITUZ, ...)
my $mainprefix;
@ -283,6 +294,25 @@ while (my $line = <CTY>) {
}
else { # prefix-line
$line =~ s/\s+//g;
# read full calls into separate hash. this hash only
# contains the information that this is a full call and
# therefore doesn't need to be handled by &wpx even if
# it contains a slash
if ($line =~ /=/) {
my @matches = ($line =~ /=([A-Z0-9\/]+)(\(\d+\))?(\[\d+\])?[,;]/g);
foreach (@matches) {
$fullcalls{$_} = 1 if $_;
}
}
# Continue with everything else. Including full calls, which will
# be read as normal prefixes.
$line =~ s/=//g;
# handle "normal" prefixes
unless (defined($prefixes{$mainprefix}[0])) {
@{$prefixes{$mainprefix}} = split(/,|;/, $line);
}
@ -436,11 +466,12 @@ else { return undef; } # no proper callsign received.
##############################################################################
#
# &dxcc determines the DXCC country of a given callsign using the cty.dat file
# provided by K1EA at http://www.k1ea.com/cty/cty.dat .
# provided by AD1C at https://www.country-files.com/
# An example entry of the file looks like this:
#
# Portugal: 14: 37: EU: 38.70: 9.20: 0.0: CT:
# CQ,CR,CR5A,CR5EBD,CR6EDX,CR7A,CR8A,CR8BWW,CS,CS98,CT,CT98;
# Portugal: 14: 37: EU: 39.50: 8.00: 0.0: CT:
# CQ,CR,CS,CT,=CR5FB/LH,=CS2HNI/LH,=CS5E/LH,=CT/DJ5AA/LH,=CT1BWW/LH,=CT1GFK/LH,=CT1GPQ/LGT,
# =CT7/ON4LO/LH,=CT7/ON7RU/LH;
#
# The first line contains the name of the country, WAZ, ITU zones, continent,
# latitude, longitude, UTC difference and main Prefix, the second line contains
@ -472,7 +503,11 @@ sub dxcc {
my $letter='';
if ($testcall =~ /(^OH\/)|(\/OH[1-9]?$)/) { # non-Aland prefix!
if ($fullcalls{$testcall}) { # direct match with "="
# do nothing! don't try to resolve WPX, it's a full
# call and will match correctly even if it contains a /
}
elsif ($testcall =~ /(^OH\/)|(\/OH[1-9]?$)/) { # non-Aland prefix!
$testcall = "OH"; # make callsign OH = finland
}
elsif ($testcall =~ /(^3D2R)|(^3D2.+\/R)/) { # seems to be from Rotuma
@ -481,6 +516,9 @@ elsif ($testcall =~ /(^3D2R)|(^3D2.+\/R)/) { # seems to be from Rotuma
elsif ($testcall =~ /^3D2C/) { # seems to be from Conway Reef
$testcall = "3D2CR"; # will match with Conway
}
elsif ($testcall =~ /(^LZ\/)|(\/LZ[1-9]?$)/) { # LZ/ is LZ0 by DXCC but this is VP8h
$testcall = "LZ";
}
elsif ($testcall =~ /\//) { # check if the callsign has a "/"
my $prfx = &wpx($testcall,1);
unless (defined($prfx)) {
@ -5859,6 +5897,8 @@ sub tqslsign {
}
# return all LoTW station locations from the global variable
# $lotwlocation which match $mycall
sub getlotwlocations {
my @a = split(/,/, $lotwlocation);
my @ret;
@ -5872,6 +5912,42 @@ sub getlotwlocations {
return @ret;
}
# find the date of the last LoTW confirmation
# in the current log. the next download should
# start at this date.
sub getlotwstartdate {
my $query = $dbh->prepare("SELECT date from log_$mycall where qslrl='Y' order by date desc limit 1");
$query->execute;
my $date = $query->fetchrow_array();
if ($date) {
return $date;
}
else {
return "1970-01-01";
}
}
sub downloadlotw {
my $startdate = shift;
my $url = "https://lotw.arrl.org/lotwuser/lotwreport.adi?qso_query=1&login=$lotwuser&password=$lotwpass&qso_qsl=yes&qso_withown=yes&qso_qslsince=$startdate";
my $filename = "/tmp/$mycall-lotw-download.adi";
my $ua = LWP::UserAgent->new(timeout => 120);
my $response = $ua->get($url);
open LOTW, ">$filename";
print LOTW $response->decoded_content;
close LOTW;
if ($response->is_success and $response->decoded_content =~ /APP_LoTW_NUMREC/) {
return $filename;
}
else {
return 0;
}
}
return 1;

Loading…
Cancel
Save