mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 14:27:42 +00:00
Overnight bug fixes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from typing import cast
|
||||
from xml.parsers.expat import ExpatError
|
||||
|
||||
import pytz
|
||||
from rss_parser import Parser as RSSParser
|
||||
@@ -25,6 +26,8 @@ class WOTA(HTTPAlertProvider):
|
||||
|
||||
def _http_response_to_alerts(self, http_response):
|
||||
new_alerts = []
|
||||
|
||||
try:
|
||||
rss = cast(RSS, RSSParser.parse(http_response.content.decode("utf-8-sig")))
|
||||
# Iterate through source data
|
||||
for source_alert in rss.channel.items:
|
||||
@@ -77,4 +80,8 @@ class WOTA(HTTPAlertProvider):
|
||||
|
||||
# Add to our list.
|
||||
new_alerts.append(alert)
|
||||
|
||||
except ExpatError:
|
||||
logger.warning("WOTA alert RSS feed was fetched but was invalid")
|
||||
|
||||
return new_alerts
|
||||
|
||||
@@ -13,10 +13,10 @@ from providers.solarconditions.solar_conditions_provider import SolarConditionsP
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Each station gets polled roughly once every hour (3600 seconds). Note that to avoid a burst of requests to the server
|
||||
# every hour, the requests for data from each station are spaced out throughout the hour, leading to one request being
|
||||
# sent every 1-2 minutes.
|
||||
POLL_INTERVAL = 3600
|
||||
# Each station gets polled roughly once every two hours (7200 seconds). Note that to avoid a burst of requests to the
|
||||
# server every two hours, the requests for data from each station are spaced out throughout the period, leading to one
|
||||
# request being sent every 3-4 minutes.
|
||||
POLL_INTERVAL = 7200
|
||||
# To avoid looking up all stations in the GIRO system and working out which ones are providing live data, this has been
|
||||
# manually determined and a CSV provided of all the stations that we can query for live data.
|
||||
STATIONS_INDEX = "datafiles/didbase-stations.csv"
|
||||
|
||||
+10
-1
@@ -1,3 +1,4 @@
|
||||
import logging
|
||||
from datetime import datetime
|
||||
|
||||
import requests
|
||||
@@ -7,6 +8,8 @@ from data.sig_ref import SIGRef
|
||||
from data.spot import Spot
|
||||
from providers.spot.http_spot_provider import HTTPSpotProvider
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Tiles(HTTPSpotProvider):
|
||||
"""Spot provider for Tiles on the Air"""
|
||||
@@ -39,13 +42,19 @@ class Tiles(HTTPSpotProvider):
|
||||
# Iterate through source data
|
||||
for source_spot in http_response.json()["spots"]:
|
||||
# Convert to our spot format
|
||||
freq = None
|
||||
try:
|
||||
freq = float(strip_extra_decimal_points(source_spot["frequency"])) * 1000000
|
||||
except ValueError:
|
||||
logger.debug(f"Malformed frequency received from Tiles API: {source_spot['frequency']}")
|
||||
|
||||
spot = Spot(
|
||||
source=self.name,
|
||||
source_id=source_spot["id"],
|
||||
dx_call=source_spot["call_sign"].upper(),
|
||||
# No separate spotter callsign, assume all spots are self-spots
|
||||
de_call=source_spot["call_sign"].upper(),
|
||||
freq=float(strip_extra_decimal_points(source_spot["frequency"])) * 1000000,
|
||||
freq=freq,
|
||||
mode=source_spot["mode"].upper(),
|
||||
comment=source_spot["notes"],
|
||||
sig="Tiles",
|
||||
|
||||
@@ -2,6 +2,7 @@ import logging
|
||||
import re
|
||||
from datetime import datetime
|
||||
from typing import cast
|
||||
from xml.parsers.expat import ExpatError
|
||||
|
||||
import pytz
|
||||
from rss_parser import Parser
|
||||
@@ -26,6 +27,7 @@ class WOTA(HTTPSpotProvider):
|
||||
|
||||
def _http_response_to_spots(self, http_response):
|
||||
new_spots = []
|
||||
try:
|
||||
rss = cast(RSS, Parser.parse(http_response.content.decode("utf-8-sig")))
|
||||
# Iterate through source data
|
||||
for source_spot in rss.channel.items:
|
||||
@@ -93,6 +95,10 @@ class WOTA(HTTPSpotProvider):
|
||||
new_spots.append(spot)
|
||||
except Exception:
|
||||
logger.exception("Exception parsing WOTA spot")
|
||||
|
||||
except ExpatError:
|
||||
logger.warning("WOTA spot RSS feed was fetched but was invalid")
|
||||
|
||||
return new_spots
|
||||
|
||||
def can_submit_spot(self, sig):
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/static/js/add-spot.js?v=1786980624"></script>
|
||||
<script src="/static/js/add-spot.js?v=1787072191"></script>
|
||||
<script>$(document).ready(function () {
|
||||
$("#nav-link-add-spot").addClass("active");
|
||||
}); <!-- highlight active page in nav --></script>
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/static/js/alerts.js?v=1786980625"></script>
|
||||
<script src="/static/js/alerts.js?v=1787072191"></script>
|
||||
<script>$(document).ready(function () {
|
||||
$("#nav-link-alerts").addClass("active");
|
||||
}); <!-- highlight active page in nav --></script>
|
||||
|
||||
@@ -76,8 +76,8 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1786980624"></script>
|
||||
<script src="/static/js/bands.js?v=1786980624"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1787072191"></script>
|
||||
<script src="/static/js/bands.js?v=1787072191"></script>
|
||||
<script>$(document).ready(function () {
|
||||
$("#nav-link-bands").addClass("active");
|
||||
}); <!-- highlight active page in nav --></script>
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
{% extends "skeleton.html" %}
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/css/style.css?v=1786980624" type="text/css">
|
||||
<link rel="stylesheet" href="/static/css/style.css?v=1787072191" type="text/css">
|
||||
<link href="/static/vendor/css/bootstrap-5.3.8.min.css" rel="stylesheet">
|
||||
<link href="/static/vendor/css/fontawesome-6.7.2.min.css" rel="stylesheet">
|
||||
<link href="/static/vendor/css/solid-6.7.2.min.css" rel="stylesheet">
|
||||
@@ -15,10 +15,10 @@
|
||||
window.fetchEventSource = fetchEventSource;
|
||||
</script>
|
||||
|
||||
<script src="/static/js/utils.js?v=1786980624"></script>
|
||||
<script src="/static/js/ui-ham.js?v=1786980624"></script>
|
||||
<script src="/static/js/geo.js?v=1786980624"></script>
|
||||
<script src="/static/js/common.js?v=1786980624"></script>
|
||||
<script src="/static/js/utils.js?v=1787072191"></script>
|
||||
<script src="/static/js/ui-ham.js?v=1787072191"></script>
|
||||
<script src="/static/js/geo.js?v=1787072191"></script>
|
||||
<script src="/static/js/common.js?v=1787072191"></script>
|
||||
{% end %}
|
||||
{% block body %}
|
||||
<div class="container">
|
||||
|
||||
@@ -284,7 +284,7 @@
|
||||
</div>
|
||||
|
||||
<script src="/static/vendor/js/chart-4.4.9.umd.min.js"></script>
|
||||
<script src="/static/js/conditions.js?v=1786980624"></script>
|
||||
<script src="/static/js/conditions.js?v=1787072191"></script>
|
||||
<script>$(document).ready(function () {
|
||||
$("#nav-link-conditions").addClass("active");
|
||||
}); <!-- highlight active page in nav --></script>
|
||||
|
||||
+2
-2
@@ -109,8 +109,8 @@
|
||||
<script src="/static/vendor/js/leaflet-cqzones.js"></script>
|
||||
<script src="/static/vendor/js/leaflet-workedallbritainireland.js" type="module"></script>
|
||||
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1786980625"></script>
|
||||
<script src="/static/js/map.js?v=1786980625"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1787072191"></script>
|
||||
<script src="/static/js/map.js?v=1787072191"></script>
|
||||
<script>$(document).ready(function () {
|
||||
$("#nav-link-map").addClass("active");
|
||||
}); <!-- highlight active page in nav --></script>
|
||||
|
||||
@@ -113,8 +113,8 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1786980624"></script>
|
||||
<script src="/static/js/spots.js?v=1786980624"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1787072191"></script>
|
||||
<script src="/static/js/spots.js?v=1787072191"></script>
|
||||
<script>$(document).ready(function () {
|
||||
$("#nav-link-spots").addClass("active");
|
||||
}); <!-- highlight active page in nav --></script>
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/static/js/status.js?v=1786980624"></script>
|
||||
<script src="/static/js/status.js?v=1787072191"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#nav-link-status").addClass("active");
|
||||
|
||||
Reference in New Issue
Block a user