bug fixes

LotW QSL check is now optional
This commit is contained in:
Michael Clemens 2022-05-20 18:46:00 +02:00
parent bb2111e3b8
commit b5b5f0aeb8
2 changed files with 37 additions and 26 deletions

View File

@ -5,13 +5,20 @@ This script is a command line DX cluster client. It adds the following benefits
* displays the DX station's country * displays the DX station's country
* displays the DX station's continent * displays the DX station's continent
* displays if the DX station uses LotW * displays if the DX station uses LotW
* downloads your LotW QSL file and marks all lines with countries that need to be confirmed * downloads your LotW QSL file and marks all lines with countries that need to be confirmed (optional)
* displays lines in different colors depending on the continent or band (user configurable) * displays lines in different colors depending on the continent or band (user configurable)
# Screnshot # Screnshot
![screenshot](/screenshot.png?raw=true "screenshot") ![screenshot](/screenshot.png?raw=true "screenshot")
# Limitations
The following limitations are present:
* read-only: you can't send commands to the dx cluster server via this tool
* no filters: you need to configure your filter on the server
# Installation # Installation
ColorSpot needs Python 3 and the following libraries: ColorSpot needs Python 3 and the following libraries:
@ -48,7 +55,7 @@ To update colorspot, execute the following command:
* adapt _~/.colorspot.ini_ to your needs. Important setting are: * adapt _~/.colorspot.ini_ to your needs. Important setting are:
* cluster/host and cluster/port: Change this if you want to use another cluster server * cluster/host and cluster/port: Change this if you want to use another cluster server
* cluster/user: Enter here your call sign * cluster/user: Enter here your call sign
* lotw/user: Enter here your lotw user name (your call sign) * lotw/user: Enter here your lotw user name (your call sign). Leave at "N0CALL" to disable this feature.
* lotw/password: Enter here your lotw password * lotw/password: Enter here your lotw password
* lotw/mode: Enter here the mode you would like to filter the QSL download from LotW * lotw/mode: Enter here the mode you would like to filter the QSL download from LotW
* execute the application again with "colorspot" * execute the application again with "colorspot"

View File

@ -57,13 +57,17 @@ class ColorSpot():
self.check_files() self.check_files()
if self.check_lotw_confirmed: if self.config['lotw']['user'] != "N0CALL" and self.check_lotw_confirmed:
self.confirmed_entities = self.get_confirmed_entities() self.confirmed_entities = self.get_confirmed_entities()
if self.check_cty: if self.check_cty:
with open(self.config_dir + self.config['files']['cty'], encoding='us-ascii') as csvfile: with open(self.config_dir + self.config['files']['cty'], encoding='us-ascii') as csvfile:
self.cty = list(csv.reader(csvfile, delimiter=',')) self.cty = list(csv.reader(csvfile, delimiter=','))
if self.check_lotw_activity:
with open(self.config_dir + self.config['files']['lotw_activity'], encoding='us-ascii') as csvfile:
self.lotw_activity = list(csv.reader(csvfile, delimiter=','))
def print_banner(self): def print_banner(self):
"""print an awesome banner""" """print an awesome banner"""
@ -163,22 +167,25 @@ class ColorSpot():
Downloads all files and unzips them (if necessary)""" Downloads all files and unzips them (if necessary)"""
# check for lotw qsl information file # check for lotw qsl information file
self.check_lotw_confirmed = exists(self.config_dir + self.config['files']['lotw_confirmed']) if self.config['lotw']['user'] != "N0CALL":
if not self.check_lotw_confirmed:
print("The file " + self.config_dir + self.config['files']['lotw_confirmed'] + " is missing.")
user = self.config['lotw']['user']
password = self.config['lotw']['password']
mode = self.config['lotw']['mode']
url = "https://lotw.arrl.org/lotwuser/lotwreport.adi?login={}&password={}"\
"&qso_query=1&qso_qsl=yes&qso_mode={}&qso_qsldetail=yes&"\
"qso_qslsince=1970-01-01".format(user, password, mode)
print("Trying to download " + url)
self.download_file(url, self.config_dir + self.config['files']['lotw_confirmed'])
self.check_lotw_confirmed = exists(self.config_dir + self.config['files']['lotw_confirmed']) self.check_lotw_confirmed = exists(self.config_dir + self.config['files']['lotw_confirmed'])
if self.check_lotw_confirmed: if not self.check_lotw_confirmed:
print("File successfully downloaded") print("The file " + self.config_dir + self.config['files']['lotw_confirmed'] + " is missing.")
else: user = self.config['lotw']['user']
print("something went wrong while downloading " + url) password = self.config['lotw']['password']
mode = self.config['lotw']['mode']
url = "https://lotw.arrl.org/lotwuser/lotwreport.adi?login={}&password={}"\
"&qso_query=1&qso_qsl=yes&qso_mode={}&qso_qsldetail=yes&"\
"qso_qslsince=1970-01-01".format(user, password, mode)
print("Trying to download " + url)
self.download_file(url, self.config_dir + self.config['files']['lotw_confirmed'])
self.check_lotw_confirmed = exists(self.config_dir + self.config['files']['lotw_confirmed'])
if self.check_lotw_confirmed:
print("File successfully downloaded")
else:
print("something went wrong while downloading " + url)
else:
self.check_lotw_confirmed = False
# check for cty.csv file # check for cty.csv file
self.check_cty = exists(self.config_dir + self.config['files']['cty']) self.check_cty = exists(self.config_dir + self.config['files']['cty'])
@ -228,13 +235,10 @@ class ColorSpot():
"""Reads the LotW user activity file and returns the date """Reads the LotW user activity file and returns the date
of the last upload date if a specific call sign""" of the last upload date if a specific call sign"""
ret = "" ret = ""
with open(self.config_dir + self.config['files']['lotw_activity'], encoding='us-ascii') as csvfile: for row in self.lotw_activity:
csv_file = csv.reader(csvfile, delimiter=',') if call == row[0]:
#loop through the csv file ret = row[1]
for row in csv_file: return ret
if call == row[0]:
ret = row[1]
return ret
return ret return ret
@ -328,7 +332,7 @@ class ColorSpot():
# If the DX station's entity hasn't been worked/confirmed via # If the DX station's entity hasn't been worked/confirmed via
# LotW yet, the row's background will be color coded. # LotW yet, the row's background will be color coded.
if self.check_lotw_confirmed and \ if self.check_lotw_confirmed and self.config['lotw']['user'] != "N0CALL" and \
cty_details[2] not in self.confirmed_entities: cty_details[2] not in self.confirmed_entities:
background = self.config['colors']['alert_bg'] background = self.config['colors']['alert_bg']
foreground = self.config['colors']['alert_fg'] foreground = self.config['colors']['alert_fg']