mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Allow table columns to be toggled on and off. #19
This commit is contained in:
@@ -113,6 +113,7 @@ def infer_country_from_callsign(call):
|
||||
|
||||
# Infer a DXCC ID from a callsign
|
||||
def infer_dxcc_id_from_callsign(call):
|
||||
get_clublog_xml_data_for_callsign("M0TRT")
|
||||
try:
|
||||
# Start with the basic country-files.com-based decoder.
|
||||
dxcc = CALL_INFO_BASIC.get_adif_id(call)
|
||||
@@ -225,7 +226,8 @@ def get_qrz_data_for_callsign(call):
|
||||
QRZ_CALLSIGN_DATA_CACHE.add(call, data, expire=604800) # 1 week in seconds
|
||||
return data
|
||||
except KeyError:
|
||||
# QRZ had no info for the call, that's OK
|
||||
# QRZ had no info for the call, that's OK. Cache a None so we don't try to look this up again
|
||||
QRZ_CALLSIGN_DATA_CACHE.add(call, None, expire=604800) # 1 week in seconds
|
||||
return None
|
||||
else:
|
||||
return None
|
||||
@@ -243,7 +245,8 @@ def get_clublog_api_data_for_callsign(call):
|
||||
CLUBLOG_CALLSIGN_DATA_CACHE.add(call, data, expire=604800) # 1 week in seconds
|
||||
return data
|
||||
except KeyError:
|
||||
# Clublog had no info for the call, that's OK
|
||||
# Clublog had no info for the call, that's OK. Cache a None so we don't try to look this up again
|
||||
CLUBLOG_CALLSIGN_DATA_CACHE.add(call, None, expire=604800) # 1 week in seconds
|
||||
return None
|
||||
except APIKeyMissingError:
|
||||
# User API key was wrong, warn
|
||||
@@ -260,7 +263,8 @@ def get_clublog_xml_data_for_callsign(call):
|
||||
data = LOOKUP_LIB_CLUBLOG_XML.lookup_callsign(callsign=call)
|
||||
return data
|
||||
except KeyError:
|
||||
# Clublog had no info for the call, that's OK
|
||||
# Clublog had no info for the call, that's OK. Cache a None so we don't try to look this up again
|
||||
CLUBLOG_CALLSIGN_DATA_CACHE.add(call, None, expire=604800) # 1 week in seconds
|
||||
return None
|
||||
else:
|
||||
return None
|
||||
@@ -310,11 +314,21 @@ def infer_latlon_from_callsign_dxcc(call):
|
||||
try:
|
||||
data = CALL_INFO_BASIC.get_lat_long(call)
|
||||
if data and "latitude" in data and "longitude" in data:
|
||||
return [data["latitude"], data["longitude"]]
|
||||
loc = [data["latitude"], data["longitude"]]
|
||||
else:
|
||||
return None
|
||||
loc = None
|
||||
except KeyError:
|
||||
return None
|
||||
loc = None
|
||||
# Couldn't get anything from basic call info database, try Clublog data
|
||||
if not loc:
|
||||
data = get_clublog_xml_data_for_callsign(call)
|
||||
if data and "Lat" in data and "Lon" in data:
|
||||
loc = [data["Lat"], data["Lon"]]
|
||||
if not loc:
|
||||
data = get_clublog_api_data_for_callsign(call)
|
||||
if data and "Lat" in data and "Lon" in data:
|
||||
loc = [data["Lat"], data["Lon"]]
|
||||
return loc
|
||||
|
||||
|
||||
# Infer a grid locator from a callsign (using DXCC, probably very inaccurate)
|
||||
|
||||
Reference in New Issue
Block a user