mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Get rid of code finding "base calls" #38
This commit is contained in:
@@ -85,12 +85,8 @@ def infer_band_from_freq(freq):
|
||||
# Infer a country name from a callsign
|
||||
def infer_country_from_callsign(call):
|
||||
try:
|
||||
# Use the full callsign, falling back to the base callsign, assuming this will be the longest of any /-separated
|
||||
# sections.
|
||||
# Start with the basic country-files.com-based decoder.
|
||||
country = CALL_INFO_BASIC.get_country_name(call)
|
||||
if not country:
|
||||
base_call = max(call.split("/"), key=len)
|
||||
country = CALL_INFO_BASIC.get_country_name(base_call)
|
||||
except KeyError as e:
|
||||
country = None
|
||||
# Couldn't get anything from basic call info database, try QRZ.com
|
||||
@@ -118,13 +114,8 @@ def infer_country_from_callsign(call):
|
||||
# Infer a DXCC ID from a callsign
|
||||
def infer_dxcc_id_from_callsign(call):
|
||||
try:
|
||||
# Start with the basic country-files.com-based decoder. Use the full callsign, falling back to the base
|
||||
# callsign, assuming this will be the longest of any /-separated sections. Then if that doesn't provide data,
|
||||
# and we have QRZ data, try the same with that.
|
||||
# Start with the basic country-files.com-based decoder.
|
||||
dxcc = CALL_INFO_BASIC.get_adif_id(call)
|
||||
if not dxcc:
|
||||
base_call = max(call.split("/"), key=len)
|
||||
dxcc = CALL_INFO_BASIC.get_adif_id(base_call)
|
||||
except KeyError as e:
|
||||
dxcc = None
|
||||
# Couldn't get anything from basic call info database, try QRZ.com
|
||||
@@ -152,12 +143,8 @@ def infer_dxcc_id_from_callsign(call):
|
||||
# Infer a continent shortcode from a callsign
|
||||
def infer_continent_from_callsign(call):
|
||||
try:
|
||||
# Start with the basic country-files.com-based decoder. Use the full callsign, falling back to the base
|
||||
# callsign, assuming this will be the longest of any /-separated sections.
|
||||
# Start with the basic country-files.com-based decoder.
|
||||
continent = CALL_INFO_BASIC.get_continent(call)
|
||||
if not continent:
|
||||
base_call = max(call.split("/"), key=len)
|
||||
continent = CALL_INFO_BASIC.get_continent(base_call)
|
||||
except KeyError as e:
|
||||
continent = None
|
||||
# Couldn't get anything from basic call info database, try Clublog data
|
||||
@@ -180,13 +167,8 @@ def infer_continent_from_callsign(call):
|
||||
# Infer a CQ zone from a callsign
|
||||
def infer_cq_zone_from_callsign(call):
|
||||
try:
|
||||
# Start with the basic country-files.com-based decoder. Use the full callsign, falling back to the base
|
||||
# callsign, assuming this will be the longest of any /-separated sections. Then if that doesn't provide data,
|
||||
# and we have QRZ data, try the same with that.
|
||||
# Start with the basic country-files.com-based decoder.
|
||||
cqz = CALL_INFO_BASIC.get_cqz(call)
|
||||
if not cqz:
|
||||
base_call = max(call.split("/"), key=len)
|
||||
cqz = CALL_INFO_BASIC.get_cqz(base_call)
|
||||
except KeyError as e:
|
||||
cqz = None
|
||||
# Couldn't get anything from basic call info database, try QRZ.com
|
||||
@@ -214,13 +196,8 @@ def infer_cq_zone_from_callsign(call):
|
||||
# Infer a ITU zone from a callsign
|
||||
def infer_itu_zone_from_callsign(call):
|
||||
try:
|
||||
# Start with the basic country-files.com-based decoder. Use the full callsign, falling back to the base
|
||||
# callsign, assuming this will be the longest of any /-separated sections. Then if that doesn't provide data,
|
||||
# and we have QRZ data, try the same with that.
|
||||
# Start with the basic country-files.com-based decoder.
|
||||
ituz = CALL_INFO_BASIC.get_ituz(call)
|
||||
if not ituz:
|
||||
base_call = max(call.split("/"), key=len)
|
||||
ituz = CALL_INFO_BASIC.get_ituz(base_call)
|
||||
except KeyError as e:
|
||||
ituz = None
|
||||
# Couldn't get anything from basic call info database, try QRZ.com
|
||||
|
||||
Reference in New Issue
Block a user