Files
spothole/main.py
2025-09-27 12:09:16 +01:00

66 lines
1.9 KiB
Python

# Main script
import signal
from core.cleanup import CleanupTimer
from core.constants import MAX_SPOT_AGE_SEC
from providers.dxcluster import DXCluster
from providers.gma import GMA
from providers.hema import HEMA
from providers.parksnpeaks import ParksNPeaks
from providers.pota import POTA
from providers.sota import SOTA
from providers.wwbota import WWBOTA
from providers.wwff import WWFF
# Shutdown function
def shutdown(sig, frame):
print("Stopping program, this may take a few seconds...")
for p in providers: p.stop()
cleanup_timer.stop()
# Main function
if __name__ == '__main__':
print("Starting...")
# 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
spot_list = []
# Set up data providers
for p in providers: p.setup(spot_list=spot_list)
# Start data providers
for p in providers: p.start()
# Set up timer to clear spot list of old data
cleanup_timer = CleanupTimer(spot_list=spot_list, cleanup_interval=60, max_spot_age=MAX_SPOT_AGE_SEC)
cleanup_timer.start()
# Todo serve spot API
# Todo spot API arguments e.g. "since" based on received_time of spots, sources, sigs, dx cont, dxcc, de cont, band, mode, filter out qrt, filter pre-qsy
# Todo serve status API
# Todo serve apidocs
# Todo serve website
print("Startup complete.")
# TODO NOTES FOR NGINX REVERSE PROXY
# local cache time of 15 sec to avoid over burdening python?
# TODO NOTES FOR FIELD SPOTTER
# Still need to de-dupe spots
# Still need to do QSY checking in FS because we can enable/disable showing them and don't want to re-query the API.
# Filter comments, still do in FS or move that here?