Add data providers for most other programmes

This commit is contained in:
Ian Renton
2025-09-27 10:00:12 +01:00
parent 7bdf6cf203
commit 27a61393cf
14 changed files with 439 additions and 102 deletions

View File

@@ -1,4 +1,4 @@
from core.constants import BANDS, UNKNOWN_BAND
from core.constants import BANDS, UNKNOWN_BAND, CW_MODES, PHONE_MODES, DATA_MODES, ALL_MODES
from pyhamtools import LookupLib, Callinfo
# Static lookup helpers from pyhamtools
@@ -6,14 +6,24 @@ from pyhamtools import LookupLib, Callinfo
lookuplib = LookupLib(lookuptype="countryfile")
callinfo = Callinfo(lookuplib)
# Infer a mode from the comment
def infer_mode_from_comment(comment):
for mode in ALL_MODES:
if mode in comment.upper():
return mode
return None
# Infer a "mode family" from a mode.
def infer_mode_family_from_mode(mode):
if mode.upper() == "CW":
if mode.upper() in CW_MODES:
return "CW"
elif mode.upper() in ["PHONE", "SSB", "USB", "LSB", "AM", "FM", "DMR", "DSTAR", "C4FM", "M17"]:
elif mode.upper() in PHONE_MODES:
return "PHONE"
elif mode.upper() in DATA_MODES:
return "DATA"
else:
return "DIGI"
print("Found an unrecognised mode: " + mode + ". Developer should categorise this.")
return None
# Infer a band from a frequency in kHz
def infer_band_from_freq(freq):