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

@@ -5,6 +5,12 @@ SOFTWARE_NAME = "Metaspot by M0TRT"
SOFTWARE_VERSION = "0.1"
SERVER_OWNER_CALLSIGN = "M0TRT"
# Modes
CW_MODES = ["CW"]
PHONE_MODES = ["PHONE", "SSB", "USB", "LSB", "AM", "FM", "DV", "DMR", "DSTAR", "C4FM", "M17"]
DATA_MODES = ["DIGI", "DATA", "FT8", "FT4", "RTTY", "SSTV", "JS8", "HELL", "BPSK", "PSK", "BPSK31", "OLIVIA"]
ALL_MODES = CW_MODES + PHONE_MODES + DATA_MODES
# Band definitions
BANDS = [
Band(name="160m", start_freq=1800, end_freq=2000, color="#7cfc00", contrast_color="black"),

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):