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