mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Compare commits
3 Commits
f2f03b135f
...
bb7b6d6f3c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb7b6d6f3c | ||
|
|
2c8d18685c | ||
|
|
090310240f |
@@ -1,7 +1,11 @@
|
|||||||
import re
|
import re
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
|
from requests_cache import CachedSession
|
||||||
from rss_parser import RSSParser
|
from rss_parser import RSSParser
|
||||||
|
|
||||||
|
from core.constants import HTTP_HEADERS
|
||||||
|
from data.spot import Spot
|
||||||
from spotproviders.http_spot_provider import HTTPSpotProvider
|
from spotproviders.http_spot_provider import HTTPSpotProvider
|
||||||
|
|
||||||
|
|
||||||
@@ -9,6 +13,9 @@ from spotproviders.http_spot_provider import HTTPSpotProvider
|
|||||||
class WOTA(HTTPSpotProvider):
|
class WOTA(HTTPSpotProvider):
|
||||||
POLL_INTERVAL_SEC = 120
|
POLL_INTERVAL_SEC = 120
|
||||||
SPOTS_URL = "https://www.wota.org.uk/spots_rss.php"
|
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):
|
def __init__(self, provider_config):
|
||||||
super().__init__(provider_config, self.SPOTS_URL, self.POLL_INTERVAL_SEC)
|
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:
|
for source_alert in rss.channel.items:
|
||||||
break
|
break
|
||||||
# TODO: Need to see a live spot to know what this feed looks like
|
# 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
|
return new_spots
|
||||||
|
|||||||
@@ -1016,4 +1016,4 @@ components:
|
|||||||
ref_regex:
|
ref_regex:
|
||||||
type: string
|
type: string
|
||||||
description: Regex that matches this SIG's reference IDs. Generally for Spothole's own internal use, clients probably won't need this.
|
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+"
|
||||||
@@ -126,7 +126,6 @@ function addAlertRowsToTable(tbody, alerts) {
|
|||||||
// Get times for the alert, and convert to local time if necessary.
|
// 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_utc = moment.unix(a["start_time"]).utc();
|
||||||
var start_time_local = start_time_utc.clone().local();
|
var start_time_local = start_time_utc.clone().local();
|
||||||
console.log(a["dx_calls"])
|
|
||||||
start_time = useLocalTime ? start_time_local : start_time_utc;
|
start_time = useLocalTime ? start_time_local : start_time_utc;
|
||||||
var end_time_utc = moment.unix(a["end_time"]).utc();
|
var end_time_utc = moment.unix(a["end_time"]).utc();
|
||||||
var end_time_local = end_time_utc.clone().local();
|
var end_time_local = end_time_utc.clone().local();
|
||||||
|
|||||||
Reference in New Issue
Block a user