ZLOTA support + misc changes

This commit is contained in:
Ian Renton
2025-10-09 21:25:01 +01:00
parent 60bb640074
commit a866d41aa7
6 changed files with 54 additions and 16 deletions

View File

@@ -1,5 +1,4 @@
import logging
from datetime import datetime
from diskcache import Cache
from pyhamtools import LookupLib, Callinfo
@@ -48,35 +47,45 @@ def infer_band_from_freq(freq):
# Infer a country name from a callsign
def infer_country_from_callsign(call):
try:
return CALL_INFO_BASIC.get_country_name(call)
# Get base callsign, assuming this will be the longest of any /-separated sections.
base_call = max(call.split("/"), key=len)
return CALL_INFO_BASIC.get_country_name(base_call)
except KeyError as e:
return None
# Infer a DXCC ID from a callsign
def infer_dxcc_id_from_callsign(call):
try:
return CALL_INFO_BASIC.get_adif_id(call)
# Get base callsign, assuming this will be the longest of any /-separated sections.
base_call = max(call.split("/"), key=len)
return CALL_INFO_BASIC.get_adif_id(base_call)
except KeyError as e:
return None
# Infer a continent shortcode from a callsign
def infer_continent_from_callsign(call):
try:
return CALL_INFO_BASIC.get_continent(call)
# Get base callsign, assuming this will be the longest of any /-separated sections.
base_call = max(call.split("/"), key=len)
return CALL_INFO_BASIC.get_continent(base_call)
except KeyError as e:
return None
# Infer a CQ zone from a callsign
def infer_cq_zone_from_callsign(call):
try:
return CALL_INFO_BASIC.get_cqz(call)
# Get base callsign, assuming this will be the longest of any /-separated sections.
base_call = max(call.split("/"), key=len)
return CALL_INFO_BASIC.get_cqz(base_call)
except KeyError as e:
return None
# Infer a ITU zone from a callsign
def infer_itu_zone_from_callsign(call):
try:
return CALL_INFO_BASIC.get_ituz(call)
# Get base callsign, assuming this will be the longest of any /-separated sections.
base_call = max(call.split("/"), key=len)
return CALL_INFO_BASIC.get_ituz(base_call)
except KeyError as e:
return None