mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Add data providers for most other programmes
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user