First attempt at converting "sig" to "activity" for v3

This commit is contained in:
Ian Renton
2026-09-24 07:09:37 +01:00
parent 1d0129f7bb
commit d91fa70655
90 changed files with 822 additions and 496 deletions
+3 -3
View File
@@ -27,7 +27,7 @@ def get_activity_ref_info(activity_name, ref_id):
ref_id = ref_id.replace(" ", "-")
# Prepare the object to be returned
activity_ref = ActivityRef(sig=activity_name, id=ref_id)
activity_ref = ActivityRef(activity=activity_name, id=ref_id)
# We can always get the reference type and the icon from the activity itself
activity = get_activity_by_name(activity_name)
@@ -141,11 +141,11 @@ def get_activity_ref_info(activity_name, ref_id):
def populate_missing_activity_ref_info(activity_ref):
"""Look up details of an activity reference (e.g. POTA park) such as name, lat/lon, and grid. Takes in an
activity_ref object which must at minimum have a "sig" and an "id". The rest of the object will be populated
activity_ref object which must at minimum have an "activity" and an "id". The rest of the object will be populated
and returned. Any data currently in the object will be kept, only missing data in the object will be populated
if it can be determined."""
lookup_data = get_activity_ref_info(activity_ref.sig, activity_ref.id)
lookup_data = get_activity_ref_info(activity_ref.activity, activity_ref.id)
if lookup_data:
# Copy new activity ref data into existing object where data was previously missing
+12
View File
@@ -19,6 +19,18 @@ with open("config.yml") as f:
config = yaml.safe_load(f)
logger.info("Loaded config.")
# Warn about config keys that were renamed from "sig" to "activity" in Spothole v3, as these will otherwise be silently
# ignored.
if "sig_ref_data_providers" in config:
logger.warning(
'Your config file contains "sig_ref_data_providers", which was renamed to "activity_ref_data_providers" in Spothole v3. Please update your config.yml, otherwise no activity reference data will be loaded.'
)
for _entry in config.get("spot_providers", []):
if "sig" in _entry or "sig_ref_prefix" in _entry:
logger.warning(
f'Your config file contains "sig" or "sig_ref_prefix" for the {_entry.get("class")} spot provider. These were renamed to "activity" and "activity_ref_prefix" in Spothole v3. Please update your config.yml.'
)
BASE_URL = config.get("base_url", "http://localhost:8080")
MAX_SPOT_AGE = config.get("max_spot_age_sec", 3600)
MAX_ALERT_AGE = config.get("max_alert_age_sec", 604800)
+1 -1
View File
@@ -2,7 +2,7 @@ from core.config import SERVER_OWNER_CALLSIGN
from data.band import Band
# General software
SOFTWARE_VERSION = "2.2"
SOFTWARE_VERSION = "3.0-pre"
# HTTP headers used for spot providers that use HTTP
HTTP_HEADERS = {"User-Agent": f"Spothole v{SOFTWARE_VERSION} (operated by {SERVER_OWNER_CALLSIGN})"}
+5 -5
View File
@@ -15,7 +15,7 @@ class DataProviders:
self.alert_providers = []
self.solar_condition_providers = []
self.static_data_providers = []
self.sig_ref_data_providers = []
self.activity_ref_data_providers = []
self.callsign_data_providers = []
self._startup_timers = []
@@ -28,8 +28,8 @@ class DataProviders:
self.solar_condition_providers.append(create_provider_from_config("providers.solarconditions", entry))
for entry in config.get("static_data_providers", []):
self.static_data_providers.append(create_provider_from_config("providers.staticdata", entry))
for entry in config.get("sig_ref_data_providers", []):
self.sig_ref_data_providers.append(create_provider_from_config("providers.activityrefdata", entry))
for entry in config.get("activity_ref_data_providers", []):
self.activity_ref_data_providers.append(create_provider_from_config("providers.activityrefdata", entry))
for entry in config.get("callsign_data_providers", []):
self.callsign_data_providers.append(create_provider_from_config("providers.callsigndata", entry))
@@ -54,7 +54,7 @@ class DataProviders:
25.0,
lambda: self.start_providers(self.solar_condition_providers, "solar condition"),
),
threading.Timer(30.0, lambda: self.start_providers(self.sig_ref_data_providers, "activity ref data")),
threading.Timer(30.0, lambda: self.start_providers(self.activity_ref_data_providers, "activity ref data")),
]
for t in self._startup_timers:
t.daemon = True
@@ -72,7 +72,7 @@ class DataProviders:
self.spot_providers
+ self.alert_providers
+ self.solar_condition_providers
+ self.sig_ref_data_providers
+ self.activity_ref_data_providers
+ self.static_data_providers
+ self.callsign_data_providers
)
+1 -1
View File
@@ -77,7 +77,7 @@ class LocationSourceForSpot(str, Enum):
"""Where the location data came from in a spot."""
SPOT = "SPOT"
SIG_REF_LOOKUP = "SIG REF LOOKUP"
ACTIVITY_REF_LOOKUP = "ACTIVITY REF LOOKUP"
GRID = "GRID"
HOME_QTH = "HOME QTH"
DXCC = "DXCC"
+5 -3
View File
@@ -111,9 +111,11 @@ class StatusReporter:
}
for p in DATA_PROVIDERS.static_data_providers
]
DATA_STORE.status.get()["sig_ref_data_providers"] = [
# Remove the old name for this key if it's still present in status data persisted by Spothole v2 and earlier
DATA_STORE.status.get().pop("sig_ref_data_providers", None)
DATA_STORE.status.get()["activity_ref_data_providers"] = [
{
"sig_name": p.sig_name,
"activity_name": p.activity_name,
"enabled": p.enabled,
"status": p.status,
"last_updated": p.last_update_time.replace(tzinfo=pytz.UTC).timestamp()
@@ -121,7 +123,7 @@ class StatusReporter:
else 0,
"reference_count": p.reference_count,
}
for p in DATA_PROVIDERS.sig_ref_data_providers
for p in DATA_PROVIDERS.activity_ref_data_providers
]
DATA_STORE.status.get()["callsign_data_providers"] = [
{