mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
ZLOTA support + misc changes
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user