Compare commits

..

3 Commits

Author SHA1 Message Date
Ian Renton
bb7b6d6f3c Remove console.log 2025-10-23 15:47:35 +01:00
Ian Renton
2c8d18685c Fix escape sequence error in API spec #65 2025-10-23 15:43:37 +01:00
Ian Renton
090310240f Add WOTA location lookup #63 2025-10-23 15:32:38 +01:00
3 changed files with 31 additions and 2 deletions

View File

@@ -1,7 +1,11 @@
import re
from datetime import timedelta
from requests_cache import CachedSession
from rss_parser import RSSParser
from core.constants import HTTP_HEADERS
from data.spot import Spot
from spotproviders.http_spot_provider import HTTPSpotProvider
@@ -9,6 +13,9 @@ from spotproviders.http_spot_provider import HTTPSpotProvider
class WOTA(HTTPSpotProvider):
POLL_INTERVAL_SEC = 120
SPOTS_URL = "https://www.wota.org.uk/spots_rss.php"
LIST_URL = "https://www.wota.org.uk/mapping/data/summits.json"
LIST_CACHE_TIME_DAYS = 30
LIST_CACHE = CachedSession("cache/wota_data_cache", expire_after=timedelta(days=LIST_CACHE_TIME_DAYS))
def __init__(self, provider_config):
super().__init__(provider_config, self.SPOTS_URL, self.POLL_INTERVAL_SEC)
@@ -20,4 +27,27 @@ class WOTA(HTTPSpotProvider):
for source_alert in rss.channel.items:
break
# TODO: Need to see a live spot to know what this feed looks like
# Convert to our spot format
# spot = Spot(source=self.name,
# source_id=source_spot["id"],
# dx_call=source_spot["activator"].upper(),
# de_call=source_spot["spotter"].upper(),
# freq=freq_hz,
# mode=source_spot["mode"].upper().strip(),
# comment=source_spot["comments"],
# sig="WOTA",
# sig_refs=[source_spot["reference"]],
# icon=get_icon_for_sig("WOTA"),
# time=datetime.fromisoformat(source_spot["referenced_time"]).astimezone(pytz.UTC).timestamp())
# WOTA name/lat/lon lookup
wota_data = self.LIST_CACHE.get(self.LIST_URL, headers=HTTP_HEADERS).json()
for feature in wota_data["features"]:
if feature["properties"]["wotaId"] == spot.sig_refs[0]:
spot.sig_refs_names = [feature["properties"]["title"]]
spot.dx_latitude = feature["geometry"]["coordinates"][1]
spot.dx_longitude = feature["geometry"]["coordinates"][0]
spot.dx_grid = feature["properties"]["qthLocator"]
break
return new_spots

View File

@@ -1016,4 +1016,4 @@ components:
ref_regex:
type: string
description: Regex that matches this SIG's reference IDs. Generally for Spothole's own internal use, clients probably won't need this.
example: "[A-Z]{2}\-\d+"
example: "[A-Z]{2}\\-\\d+"

View File

@@ -126,7 +126,6 @@ function addAlertRowsToTable(tbody, alerts) {
// Get times for the alert, and convert to local time if necessary.
var start_time_utc = moment.unix(a["start_time"]).utc();
var start_time_local = start_time_utc.clone().local();
console.log(a["dx_calls"])
start_time = useLocalTime ? start_time_local : start_time_utc;
var end_time_utc = moment.unix(a["end_time"]).utc();
var end_time_local = end_time_utc.clone().local();