parent
ec22e689fe
commit
6b4672bd32
41
colorspot.py
41
colorspot.py
|
@ -60,6 +60,10 @@ class ColorSpot():
|
||||||
'port': '7373',
|
'port': '7373',
|
||||||
'user': 'N0CALL',
|
'user': 'N0CALL',
|
||||||
'timeout': '100'}
|
'timeout': '100'}
|
||||||
|
config['lotw'] = {
|
||||||
|
'user': 'N0CALL',
|
||||||
|
'password': 'XXXXXXXXX',
|
||||||
|
'mode': 'ssb'}
|
||||||
config['band_colors'] = {
|
config['band_colors'] = {
|
||||||
"145": "white",
|
"145": "white",
|
||||||
"144": "white",
|
"144": "white",
|
||||||
|
@ -92,9 +96,6 @@ class ColorSpot():
|
||||||
'alert_bg': 'indian_red_1a',
|
'alert_bg': 'indian_red_1a',
|
||||||
'alert_fg': 'white',
|
'alert_fg': 'white',
|
||||||
'default_bg': 'black'}
|
'default_bg': 'black'}
|
||||||
config['alias']= {
|
|
||||||
'Asiatic Russia': 'Russia',
|
|
||||||
'European Russia': 'Russia'}
|
|
||||||
config['dxcc'] = {
|
config['dxcc'] = {
|
||||||
"1A": "Sov. Mil. Order of Malta,EU",
|
"1A": "Sov. Mil. Order of Malta,EU",
|
||||||
"3A": "Monaco,EU",
|
"3A": "Monaco,EU",
|
||||||
|
@ -753,12 +754,12 @@ class ColorSpot():
|
||||||
def get_confirmed_countries(self):
|
def get_confirmed_countries(self):
|
||||||
ret = []
|
ret = []
|
||||||
#TODO: download file and/or tell user what to do
|
#TODO: download file and/or tell user what to do
|
||||||
file = open("lotwreport.adi", "r")
|
file = open("lotw.adi", "r")
|
||||||
for row in file:
|
for row in file:
|
||||||
if re.search("COUNTRY", row):
|
if re.search("COUNTRY", row):
|
||||||
country = row.partition(">")[2].lower().rstrip()
|
country = row.partition(">")[2].lower().rstrip()
|
||||||
if country in self.config['alias']:
|
country = re.sub('European ', '', country, flags=re.IGNORECASE)
|
||||||
country = self.config['alias'][country]
|
country = re.sub('Asiatic ', '', country, flags=re.IGNORECASE)
|
||||||
if country not in ret:
|
if country not in ret:
|
||||||
ret.append(country)
|
ret.append(country)
|
||||||
return ret
|
return ret
|
||||||
|
@ -793,12 +794,24 @@ class ColorSpot():
|
||||||
line_enc = telnet.read_until(b"\n") # Read one line
|
line_enc = telnet.read_until(b"\n") # Read one line
|
||||||
line = line_enc.decode('ascii')
|
line = line_enc.decode('ascii')
|
||||||
if "enter your call" in line:
|
if "enter your call" in line:
|
||||||
my_str_as_bytes = str.encode(self.config['cluster']['user']+"\n")
|
b_user = str.encode(self.config['cluster']['user']+"\n")
|
||||||
telnet.write(my_str_as_bytes)
|
telnet.write(b_user)
|
||||||
elif "DX de" in line:
|
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:
|
try:
|
||||||
band_col = ""
|
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)
|
freq = re.search(': +(.+?) ', line).group(1)
|
||||||
call_dx = re.search(freq + ' +(.+?) ', line).group(1)
|
call_dx = re.search(freq + ' +(.+?) ', line).group(1)
|
||||||
time = re.search('[^ ]*$', line).group(0)[0:4]
|
time = re.search('[^ ]*$', line).group(0)[0:4]
|
||||||
|
@ -811,7 +824,7 @@ class ColorSpot():
|
||||||
|
|
||||||
lotw = ""
|
lotw = ""
|
||||||
if lotw_date:
|
if lotw_date:
|
||||||
lotw = "[LotW] "
|
lotw = "✓"
|
||||||
try:
|
try:
|
||||||
if self.config['colors']['color_by'] == "band":
|
if self.config['colors']['color_by'] == "band":
|
||||||
foreground = self.config['band_colors'][freq[:-5]]
|
foreground = self.config['band_colors'][freq[:-5]]
|
||||||
|
@ -833,15 +846,13 @@ class ColorSpot():
|
||||||
sep = fg("grey_27")+'|'+fg(foreground)
|
sep = fg("grey_27")+'|'+fg(foreground)
|
||||||
|
|
||||||
row = [call_de, sep, freq, sep, call_dx, \
|
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) + \
|
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:
|
except AttributeError:
|
||||||
print(line)
|
print(line)
|
||||||
elif "login: " in line:
|
|
||||||
print(fg("grey_27") + line + attr("reset"))
|
|
||||||
|
|
||||||
#####################################################
|
#####################################################
|
||||||
# Main Routine #
|
# Main Routine #
|
||||||
|
|
Loading…
Reference in New Issue