mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 14:27:42 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55eaa871e9 | ||
|
|
1b62d4742b |
@@ -261,6 +261,9 @@ sig_ref_data_providers:
|
||||
- class: "COTA"
|
||||
enabled: true
|
||||
|
||||
- class: "PGA"
|
||||
enabled: true
|
||||
|
||||
- class: "Toilets"
|
||||
enabled: true
|
||||
|
||||
|
||||
@@ -242,6 +242,15 @@ SIGS = [
|
||||
region_flag="🇩🇪",
|
||||
refs_globally_unique=False
|
||||
),
|
||||
SIG(
|
||||
name="PGA",
|
||||
comment_names=["PGA"],
|
||||
description="Polish Gmina Award",
|
||||
ref_regex=r"[A-Z]{2}[0-9]{2}",
|
||||
icon="fa-g",
|
||||
region_flag="🇵🇱",
|
||||
refs_globally_unique=False
|
||||
),
|
||||
SIG(
|
||||
name="Toilets",
|
||||
comment_names=[],
|
||||
|
||||
+2
-2
@@ -31,10 +31,10 @@ def infer_mode_from_comment(comment):
|
||||
"""Infer a mode from the comment"""
|
||||
|
||||
for mode in ALL_MODES:
|
||||
if re.match(r"(^|\W)" + mode + r"($|\W)", comment, re.IGNORECASE):
|
||||
if re.search(r"(^|\W)" + mode + r"($|\W)", comment, re.IGNORECASE):
|
||||
return mode
|
||||
for mode in MODE_ALIASES:
|
||||
if re.match(r"(^|\W)" + mode + r"($|\W)", comment, re.IGNORECASE):
|
||||
if re.search(r"(^|\W)" + mode + r"($|\W)", comment, re.IGNORECASE):
|
||||
return MODE_ALIASES[mode]
|
||||
return None
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
from time import sleep
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
from data.sig_ref import SIGRef
|
||||
from providers.sigrefdata.file_download_sig_ref_data_provider import FileDownloadSIGRefDataProvider
|
||||
|
||||
|
||||
class PGA(FileDownloadSIGRefDataProvider):
|
||||
"""SIG ref data provider for Polish Gmina Award"""
|
||||
|
||||
POLL_INTERVAL_DAYS = 30
|
||||
SIG = "PGA"
|
||||
DATA_URL = "http://www.spga.pl/lista_pga2.php"
|
||||
|
||||
def __init__(self, provider_config):
|
||||
super().__init__(self.SIG, provider_config, self.DATA_URL, self.POLL_INTERVAL_DAYS)
|
||||
|
||||
def _http_response_to_data(self, http_response):
|
||||
new_data = []
|
||||
soup = BeautifulSoup(http_response.text, "html.parser")
|
||||
|
||||
# Iterate through tables in the page
|
||||
for table in soup.find_all("table"):
|
||||
header_cells = table.find_all(["th", "td"], limit=10)
|
||||
header_texts = [c.get_text(strip=True) for c in header_cells]
|
||||
|
||||
# If it has "PGA" and "Nazwa" in the header, it's the main data table
|
||||
if any("PGA" in t for t in header_texts) and any("Nazwa" in t for t in header_texts):
|
||||
# Iterate through all rows except the first
|
||||
rows = table.find_all("tr")
|
||||
for row in rows[1:]:
|
||||
cells = row.find_all("td")
|
||||
ref_id = cells[0].get_text(strip=True)
|
||||
name = cells[1].get_text(strip=True)
|
||||
if not ref_id:
|
||||
continue
|
||||
|
||||
new_data.append(
|
||||
SIGRef(
|
||||
sig=self.SIG,
|
||||
id=ref_id,
|
||||
name=name,
|
||||
ref_type="Region",
|
||||
)
|
||||
)
|
||||
|
||||
# Bail out if a stop has been requested, i.e. the program is shutting down - no need to parse the rest
|
||||
# of the data in this case
|
||||
if self._stop_event.is_set():
|
||||
break
|
||||
|
||||
# Very short pause. This will extend the time to handle sig refs by a few seconds but will ensure some time
|
||||
# is available for other threads e.g. the web server.
|
||||
sleep(0.001)
|
||||
|
||||
return new_data
|
||||
@@ -10,6 +10,7 @@ from core.constants import SOFTWARE_VERSION
|
||||
from core.data_providers import DATA_PROVIDERS
|
||||
from core.data_store import DATA_STORE
|
||||
from core.status_reporter import StatusReporter
|
||||
from core.utils import infer_mode_from_comment
|
||||
from server.webserver import WEB_SERVER
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -17,7 +17,7 @@ info:
|
||||
|
||||
### 2.1
|
||||
|
||||
* Added DTMBA, FEA and BIWOTA SIGs
|
||||
* Added DTMBA, FEA, BIWOTA, COTA & PGA SIGs
|
||||
* Removed the distinction between LSB & USB (both will now show as SSB) and between the various digital voice modes, which will now show as DV.
|
||||
* Added `icon`, `region_flag` and `refs_globally_unique` to SIG information
|
||||
|
||||
@@ -861,6 +861,8 @@ components:
|
||||
- FEA
|
||||
- DTMBA
|
||||
- BIWOTA
|
||||
- COTA
|
||||
- PGA
|
||||
- Toilets
|
||||
example: POTA
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
Air (WOTA), Beaches on the Air (BOTA), Lagos y Lagunas On the Air (LLOTA), Towers on the Air, Tiles on
|
||||
the Air, Worked All Britain (WAB), Worked All Ireland (WAI), el Diploma Municipios de España (DME), el Diploma
|
||||
Faros de España (FEA), il Diploma Teatri Musei e Belle Arti (DTMBA), British Inland Waterways on the Air
|
||||
(BIWOTA) and Toilets on the Air.</p>
|
||||
(BIWOTA), Castles on the Air (COTA), Polish Gmina Award (PGA), and Toilets on the Air.</p>
|
||||
<p>As of the time of writing in August 2026, I think Spothole captures most outdoor radio programmes that have a
|
||||
defined, downloadable reference list, and almost certainly those that have a spotting/alerting API. If you know
|
||||
of one I've missed, please let me know!</p>
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/static/js/add-spot.js?v=1788207475"></script>
|
||||
<script src="/static/js/add-spot.js?v=1788209684"></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=1788207475"></script>
|
||||
<script src="/static/js/alerts.js?v=1788209684"></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=1788207475"></script>
|
||||
<script src="/static/js/bands.js?v=1788207475"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1788209684"></script>
|
||||
<script src="/static/js/bands.js?v=1788209684"></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=1788207475" type="text/css">
|
||||
<link rel="stylesheet" href="/static/css/style.css?v=1788209684" 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=1788207475"></script>
|
||||
<script src="/static/js/ui-ham.js?v=1788207475"></script>
|
||||
<script src="/static/js/geo.js?v=1788207475"></script>
|
||||
<script src="/static/js/common.js?v=1788207475"></script>
|
||||
<script src="/static/js/utils.js?v=1788209684"></script>
|
||||
<script src="/static/js/ui-ham.js?v=1788209684"></script>
|
||||
<script src="/static/js/geo.js?v=1788209684"></script>
|
||||
<script src="/static/js/common.js?v=1788209684"></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=1788207475"></script>
|
||||
<script src="/static/js/conditions.js?v=1788209684"></script>
|
||||
<script>$(document).ready(function () {
|
||||
$("#nav-link-conditions").addClass("active");
|
||||
}); <!-- highlight active page in nav --></script>
|
||||
|
||||
+2
-2
@@ -113,8 +113,8 @@
|
||||
const CARTODB_API_KEY = "{{ web_ui_options.get('cartodb_api_key', '') }}";
|
||||
</script>
|
||||
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1788207475"></script>
|
||||
<script src="/static/js/map.js?v=1788207475"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1788209683"></script>
|
||||
<script src="/static/js/map.js?v=1788209683"></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=1788207475"></script>
|
||||
<script src="/static/js/spots.js?v=1788207475"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1788209683"></script>
|
||||
<script src="/static/js/spots.js?v=1788209683"></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=1788207475"></script>
|
||||
<script src="/static/js/status.js?v=1788209684"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#nav-link-status").addClass("active");
|
||||
|
||||
Reference in New Issue
Block a user