added header

bugfixes
This commit is contained in:
Michael Clemens 2022-05-19 17:40:17 +02:00
parent ec22e689fe
commit 6b4672bd32
1 changed files with 26 additions and 15 deletions

View File

@ -60,6 +60,10 @@ class ColorSpot():
'port': '7373',
'user': 'N0CALL',
'timeout': '100'}
config['lotw'] = {
'user': 'N0CALL',
'password': 'XXXXXXXXX',
'mode': 'ssb'}
config['band_colors'] = {
"145": "white",
"144": "white",
@ -92,9 +96,6 @@ class ColorSpot():
'alert_bg': 'indian_red_1a',
'alert_fg': 'white',
'default_bg': 'black'}
config['alias']= {
'Asiatic Russia': 'Russia',
'European Russia': 'Russia'}
config['dxcc'] = {
"1A": "Sov. Mil. Order of Malta,EU",
"3A": "Monaco,EU",
@ -753,12 +754,12 @@ class ColorSpot():
def get_confirmed_countries(self):
ret = []
#TODO: download file and/or tell user what to do
file = open("lotwreport.adi", "r")
file = open("lotw.adi", "r")
for row in file:
if re.search("COUNTRY", row):
country = row.partition(">")[2].lower().rstrip()
if country in self.config['alias']:
country = self.config['alias'][country]
country = re.sub('European ', '', country, flags=re.IGNORECASE)
country = re.sub('Asiatic ', '', country, flags=re.IGNORECASE)
if country not in ret:
ret.append(country)
return ret
@ -793,12 +794,24 @@ class ColorSpot():
line_enc = telnet.read_until(b"\n") # Read one line
line = line_enc.decode('ascii')
if "enter your call" in line:
my_str_as_bytes = str.encode(self.config['cluster']['user']+"\n")
telnet.write(my_str_as_bytes)
elif "DX de" in line:
b_user = str.encode(self.config['cluster']['user']+"\n")
telnet.write(b_user)
elif " Hello " in line:
print(fg("grey_27") + line + attr("reset"))
foreground = "white"
background = "grey_27"
sep = fg("grey_27")+'|'+fg(foreground)
row = ["DE", sep, "Freq", sep, "DX", \
sep, "Country", sep, "C", sep, "L", sep, "Comment", sep, "Time"]
print(bg(background) + fg(foreground) + \
'{:9.9} {:<1} {:>7.7} {:<1} {:<10.10} {:<1} {:<16.16} {:<1} {:<2.2} {:<1} {:<1.1} {:<1} {:<30.30} {:<1} {:<4.4}'.format(*row) + attr("reset"))
b_cmd = str.encode("sh/dx/50 @\n")
telnet.write(b_cmd)
elif "DX de" in line or "Dx de" in line:
try:
band_col = ""
call_de = re.search('DX de (.+?): ', line).group(1)
call_de = re.search('D(X|x) de (.+?): ', line).group(2)
freq = re.search(': +(.+?) ', line).group(1)
call_dx = re.search(freq + ' +(.+?) ', line).group(1)
time = re.search('[^ ]*$', line).group(0)[0:4]
@ -811,7 +824,7 @@ class ColorSpot():
lotw = ""
if lotw_date:
lotw = "[LotW] "
lotw = ""
try:
if self.config['colors']['color_by'] == "band":
foreground = self.config['band_colors'][freq[:-5]]
@ -833,15 +846,13 @@ class ColorSpot():
sep = fg("grey_27")+'|'+fg(foreground)
row = [call_de, sep, freq, sep, call_dx, \
sep, areaname, sep, continent, sep, lotw + comment, sep, time]
sep, areaname, sep, continent, sep, lotw, sep, comment, sep, time]
print(bg(background) + fg(foreground) + \
'{:9.9} {:<1} {:>7.7} {:<1} {:<10.10} {:<1} {:<16.16} {:<1} {:<2.2} {:<1} {:<30.30} {:<1} {:<4.4}'.format(*row) + attr("reset"))
'{:9.9} {:<1} {:>7.7} {:<1} {:<10.10} {:<1} {:<16.16} {:<1} {:<2.2} {:<1} {:<1.1} {:<1} {:<30.30} {:<1} {:<4.4}'.format(*row) + attr("reset"))
except AttributeError:
print(line)
elif "login: " in line:
print(fg("grey_27") + line + attr("reset"))
#####################################################
# Main Routine #