Make list of providers configurable, and add RBN support.

This commit is contained in:
Ian Renton
2025-09-28 16:46:28 +01:00
parent 92fa0c52cd
commit 61125ca640
4 changed files with 157 additions and 14 deletions

43
main.py
View File

@@ -11,6 +11,7 @@ from providers.gma import GMA
from providers.hema import HEMA
from providers.parksnpeaks import ParksNPeaks
from providers.pota import POTA
from providers.rbn import RBN
from providers.sota import SOTA
from providers.wwbota import WWBOTA
from providers.wwff import WWFF
@@ -27,6 +28,31 @@ def shutdown(sig, frame):
for p in providers: p.stop()
cleanup_timer.stop()
# Utility method to get a data provider based on its config entry.
# TODO we could probably find a way to do this more neatly by iterating through classes in "providers" and getting their
# names, if Python allows that sort of thing
def get_provider_from_config(config_providers_entry):
match config_providers_entry["type"]:
case "POTA":
return POTA()
case "SOTA":
return SOTA()
case "WWFF":
return WWFF()
case "GMA":
return GMA()
case "WWBOTA":
return WWBOTA()
case "HEMA":
return HEMA()
case "ParksNPeaks":
return ParksNPeaks()
case "DXCluster":
return DXCluster(config_providers_entry["host"], config_providers_entry["port"])
case "RBN":
return RBN(config_providers_entry["port"])
return None
# Main function
if __name__ == '__main__':
@@ -43,21 +69,14 @@ if __name__ == '__main__':
# Shut down gracefully on SIGINT
signal.signal(signal.SIGINT, shutdown)
# Create providers
providers = [
POTA(),
SOTA(),
WWFF(),
WWBOTA(),
GMA(),
HEMA(),
ParksNPeaks(),
DXCluster("hrd.wa9pie.net", 8000),
# DXCluster("dxc.w3lpl.net", 22)
]
# Set up spot list & status data areas
spot_list = []
status_data = {}
# Create data providers
providers = []
for entry in config["providers"]:
providers.append(get_provider_from_config(entry))
# Set up data providers
for p in providers: p.setup(spot_list=spot_list)
# Start data providers