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
|
# Infer a country name from a callsign
|
||||||
def infer_country_from_callsign(call):
|
def infer_country_from_callsign(call):
|
||||||
try:
|
try:
|
||||||
# Use the full callsign, falling back to the base callsign, assuming this will be the longest of any /-separated
|
# Start with the basic country-files.com-based decoder.
|
||||||
# sections.
|
|
||||||
country = CALL_INFO_BASIC.get_country_name(call)
|
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:
|
except KeyError as e:
|
||||||
country = None
|
country = None
|
||||||
# Couldn't get anything from basic call info database, try QRZ.com
|
# 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
|
# Infer a DXCC ID from a callsign
|
||||||
def infer_dxcc_id_from_callsign(call):
|
def infer_dxcc_id_from_callsign(call):
|
||||||
try:
|
try:
|
||||||
# Start with the basic country-files.com-based decoder. Use the full callsign, falling back to the base
|
# Start with the basic country-files.com-based decoder.
|
||||||
# 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.
|
|
||||||
dxcc = CALL_INFO_BASIC.get_adif_id(call)
|
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:
|
except KeyError as e:
|
||||||
dxcc = None
|
dxcc = None
|
||||||
# Couldn't get anything from basic call info database, try QRZ.com
|
# 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
|
# Infer a continent shortcode from a callsign
|
||||||
def infer_continent_from_callsign(call):
|
def infer_continent_from_callsign(call):
|
||||||
try:
|
try:
|
||||||
# Start with the basic country-files.com-based decoder. Use the full callsign, falling back to the base
|
# Start with the basic country-files.com-based decoder.
|
||||||
# callsign, assuming this will be the longest of any /-separated sections.
|
|
||||||
continent = CALL_INFO_BASIC.get_continent(call)
|
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:
|
except KeyError as e:
|
||||||
continent = None
|
continent = None
|
||||||
# Couldn't get anything from basic call info database, try Clublog data
|
# 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
|
# Infer a CQ zone from a callsign
|
||||||
def infer_cq_zone_from_callsign(call):
|
def infer_cq_zone_from_callsign(call):
|
||||||
try:
|
try:
|
||||||
# Start with the basic country-files.com-based decoder. Use the full callsign, falling back to the base
|
# Start with the basic country-files.com-based decoder.
|
||||||
# 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.
|
|
||||||
cqz = CALL_INFO_BASIC.get_cqz(call)
|
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:
|
except KeyError as e:
|
||||||
cqz = None
|
cqz = None
|
||||||
# Couldn't get anything from basic call info database, try QRZ.com
|
# 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
|
# Infer a ITU zone from a callsign
|
||||||
def infer_itu_zone_from_callsign(call):
|
def infer_itu_zone_from_callsign(call):
|
||||||
try:
|
try:
|
||||||
# Start with the basic country-files.com-based decoder. Use the full callsign, falling back to the base
|
# Start with the basic country-files.com-based decoder.
|
||||||
# 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.
|
|
||||||
ituz = CALL_INFO_BASIC.get_ituz(call)
|
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:
|
except KeyError as e:
|
||||||
ituz = None
|
ituz = None
|
||||||
# Couldn't get anything from basic call info database, try QRZ.com
|
# Couldn't get anything from basic call info database, try QRZ.com
|
||||||
|
|||||||
Reference in New Issue
Block a user