Various stuff

This commit is contained in:
Ian Renton
2025-09-30 20:51:56 +01:00
parent 280749919d
commit 37692f41a8
9 changed files with 100 additions and 56 deletions

View File

@@ -3,6 +3,7 @@ from datetime import datetime
from diskcache import Cache
from pyhamtools import LookupLib, Callinfo
from pyhamtools.frequency import freq_to_band
from pyhamtools.locator import latlong_to_locator
from core.config import config
@@ -25,7 +26,7 @@ def infer_mode_from_comment(comment):
return None
# Infer a "mode family" from a mode.
def infer_mode_family_from_mode(mode):
def infer_mode_type_from_mode(mode):
if mode.upper() in CW_MODES:
return "CW"
elif mode.upper() in PHONE_MODES:
@@ -137,6 +138,11 @@ def infer_grid_from_callsign_dxcc(call):
return latlong_to_locator(latlon[0], latlon[1], 8)
# Infer a mode from the frequency according to the band plan. Just a guess really.
def infer_mode_from_frequency(freq):
return freq_to_band(freq)["mode"]
# Convert objects to serialisable things. Used by JSON serialiser as a default when it encounters unserializable things.
# Converts datetimes to ISO.
# Anything else it tries to convert to a dict.