Browse Source

1. Added qrz.com lookups during log entry mode for the fields

"QTH" and "Name". If a previous QSO with the same call has been
   saved in the past, the fields will be filled with the previously
   entered details. Empty fields will always be filled with qrz.com
   data if available.
2. Added ADIF export for queued QSLs. All QSOs with QSLS="Q" will
   be exported into the file system in ADIF format. Exported QSOs
   will be updated to QSLS="Y"
develop
Michael Clemens 3 years ago
parent
commit
3b040b1db7
  1. 39
      yfk
  2. 45
      yfksubs.pl

39
yfk

@ -719,6 +719,7 @@ while ($status == 2) {
"Edit Name/QTH DB - Edit the database used to save Names and QTHs",
"Import from LoTW - Read LoTW report and update the confirmations",
"Export to LoTW - Generate ADIF file of QSOs not uploaded yet",
"Export QSL ADIF - Generate ADIF file of QSOs with QSL status 'Q'",
"Setup YFKlog - Most logbook settings can be changed here",
"DX cluster - Console for the DX cluster"
);
@ -779,12 +780,15 @@ while ($status == 2) {
elsif ($choice == 12) { # LoTW export
$status = 14;
}
elsif ($choice == 13) { # Setup mode
elsif ($choice == 13) { # Queued QSL export
$status = 15;
}
elsif ($choice == 14) { # Setup mode
$status = 16;
}
elsif ($choice == 15) { # Setup DX cluster
$status = 17;
}
} # end of $status == 2, Main menu
@ -1123,9 +1127,10 @@ while ($status == 6) {
##############################################################################
# ADIF EXPORT MODE $status = 7
# LoTW ADIF export mode, $status = 14
# Queued QSL ADIF export mode, $status = 15
##############################################################################
while (($status == 7) || ($status == 14)) {
while (($status == 7) || ($status == 14) || ($status == 15)) {
my $filename; # filename for the adif/lotw file
my $nr; # number of exported QSOs
my ($date1, $date2, $daterange) = ('','','1');
@ -1141,6 +1146,9 @@ while (($status == 7) || ($status == 14)) {
addstr($whead, 0,0, "YFKlog v$yfkver - LoTW export mode - Active Logbook: ".
"\U$mycall"." - DB: $dbname @ $dbserver".' ' x 30) if ($status == 14);
addstr($whead, 0,0, "YFKlog v$yfkver - Queued QSL export mode - Active Logbook: ".
"\U$mycall"." - DB: $dbname @ $dbserver".' ' x 30) if ($status == 15);
addstr($whelp, 0,0, "Enter a filename to export. F1: Main Menu F12: Exit"." " x 70);
addstr($wmain,0,0," "x(80*($row-2))); # clear main window
refresh($whelp);
@ -1224,6 +1232,7 @@ while (($status == 7) || ($status == 14)) {
# Export the log to $filename
$nr = &adifexport($filename, 'adif', $daterange) if ($status == 7);
$nr = &adifexport($filename, 'lotw', $daterange) if ($status == 14);
$nr = &adifexport($filename, 'queue', $daterange) if ($status == 15);
# if the user was impatient and pressed enter, he will not see the
# following screen, so flush the input buffer
@ -2002,13 +2011,13 @@ while ($status == 13) {
} # end of $status = 13, LoTW import
##############################################################################
# SETUP MODE $status == 15
# SETUP MODE $status == 16
# All settings of the .yfklog config file can be set/modified here. This will
# be the default mode at startup, when YFKlog cannot find a .yfklog file
# anywhere.
##############################################################################
while ($status == 15) {
while ($status == 16) {
attron($wmain, COLOR_PAIR(4));
addstr($whead, 0,0, "YFKlog v$yfkver - Setup - Active Logbook: ".
"\U$mycall"." - DB: $dbname @ $dbserver".' ' x 30);
@ -2062,7 +2071,9 @@ while ($status == 15) {
sprintf("dxcport=%-15s - DX cluster port", $yfksubs::dxcport),
sprintf("dxccall=%-15s - DX cluster login call", $yfksubs::dxccall),
sprintf("dxcmode=%-15s - DX cluster mode (B = bandmap, N = normal)", $yfksubs::dxcmode),
sprintf("cursoron=%-15s - Cursor always visible (1/0)", $yfksubs::cursoron)
sprintf("cursoron=%-15s - Cursor always visible (1/0)", $yfksubs::cursoron),
sprintf("qrzuser=%-15s - QRZ.com user name", $yfksubs::qrzuser),
sprintf("qrzpass=%-15s - QRZ.com password (NOT the API key)", $yfksubs::qrzpass)
);
my $choice = &selectlist(\$wmain, 2, 1, $row-6, 78, \@setup);
@ -2440,6 +2451,22 @@ while ($status == 15) {
&changeconfig($original, "cursoron=$ret");
}
}
elsif ($choice == 40) {
$original = "qrzuser=$yfksubs::qrzuser";
my $ret = &askbox(10,5,4,70, '[01]', "QRZ.com user name", $yfksubs::qrzuser);
if ($ret eq 'm') { last }
elsif ($ret ne '') {
&changeconfig($original, "qrzuser=$ret");
}
}
elsif ($choice == 41) {
$original = "qrzpass=$yfksubs::qrzpass";
my $ret = &askbox(10,5,4,70, '[01]', "QRZ.com password (NOT the API key)", $yfksubs::qrzpass);
if ($ret eq 'm') { last }
elsif ($ret ne '') {
&changeconfig($original, "qrzpass=$ret");
}
}
&readconfig;
&readsubconfig;
@ -2449,7 +2476,7 @@ while ($status == 15) {
# DX cluster console
##############################################################################
while ($status == 16) {
while ($status == 17) {
my $in;
attron($wmain, COLOR_PAIR(4));
addstr($whead, 0,0, "YFKlog v$yfkver - DX cluster console - Active Logbook: ".

45
yfksubs.pl

@ -58,6 +58,8 @@ if ($havehamdb) {
$hamdb->initialize_dbs();
}
my $haveqrz = eval "require Ham::Reference::QRZ;";
# We load the default values for some variables that can be changed in .yfklog
@ -124,6 +126,9 @@ my %wkdcalls = (); # worked calls - those will not be highlighted on the bandma
our $cursoron = 1; # show cursor all the time? (makes things easy for people with a screen reader)
our $qrzuser = ""; # QRZ.com username for querying data from QRZ.com
our $qrzpass = ""; # QRZ.com password (NOT the API key)
share(@dxspots);
share(@dxlines);
share(@dxinput);
@ -491,7 +496,12 @@ while (defined (my $line = <CONFIG>)) { # Read line into $line
elsif ($line =~ /^cursoron=(.+)/) {
$cursoron = $1;
}
elsif ($line =~ /^qrzuser=(.+)/) {
$qrzuser = $1;
}
elsif ($line =~ /^qrzpass=(.+)/) {
$qrzpass = $1;
}
}
close CONFIG; # Configuration read.
@ -1632,6 +1642,33 @@ sub callinfo {
refresh($wi[7]);
$foundlog = 1;
}
# If QTH or name is empty, query qrz.com to add missing details.
if ($haveqrz && ($qrzuser ne "") && ($qrzpass ne "") &&
((${$_[0]}[7] == "") || (${$_[0]}[7] == ""))) {
my $qrz = Ham::Reference::QRZ->new(
callsign => $call,
username => $qrzuser,
password => $qrzpass
);
my $listing = $qrz->get_listing;
# If no name has been found in a previous qso, grab name from qrz
if (${$_[0]}[7] == "") {
my $qrzname = $listing->{fname}." ".$listing->{name};
${$_[0]}[7] = $qrzname;
addstr($wi[7],0,0,"$qrzname");
refresh($wi[7]);
}
# If no QTH has been found in a previous qso, grab QTH from qrz
if (${$_[0]}[6] == "") {
${$_[0]}[6] = $listing->{addr2};
addstr($wi[6],0,0,"$listing->{addr2}");
refresh($wi[6]);
}
}
# Now the previous QSOs with the station will be displayed. A database
@ -3275,11 +3312,12 @@ sub emptyqslqueue {
# if $_[1] is 'adif', all QSOs are exported
# if $_[1] is 'lotw', all QSOs where QSLRL = 'N' are exported and set to 'R'
# for 'Requested'.
# if $_[1] is 'queue', all QSOs where QSLS = 'Q' are exported
##############################################################################
sub adifexport {
my $filename = $_[0]; # Where to save the exported data
my $export = $_[1]; # 'lotw' or 'adi'.
my $export = $_[1]; # 'lotw', 'queue' or 'adi'.
my $daterange= $_[2]; # date range for exporting
my $nr=0; # number of QSOs exported. return value
my $sql = 'WHERE ';
@ -3290,6 +3328,7 @@ sub adifexport {
print ADIF "Exported from the logbook of $mycall by YFKlog.\n<eoh>";
$sql .= " QSLRL = 'N' AND " if ($export eq 'lotw');
$sql .= " QSLS = 'Q' AND " if ($export eq 'queue');
$sql .= $daterange;
@ -3383,6 +3422,8 @@ sub adifexport {
if ($export eq 'lotw') {
$dbh->do("UPDATE log_$mycall set qslrl='R' where qslrl='N' and $daterange")
}
$dbh->do("UPDATE log_$mycall set qsls='Y' where qsls='Q' AND ".$daterange) if
($export eq 'queue');
return $nr; # return number of exported QSOs...
} # end of ADIF export

Loading…
Cancel
Save