mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 14:27:42 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f96e0ede1 | ||
|
|
190c9f6cef | ||
|
|
d33259d619 |
+6
-6
@@ -10,7 +10,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
|
||||
refs_globally_unique=False,
|
||||
# No sensible way to determine *which* contest, but if we set comment_names=["CONTEST"] then at least
|
||||
# any spots with "contest" in the comment will get allocated to this activity.
|
||||
comment_names=["CONTEST"],
|
||||
comment_names=["CONTEST", "TEST"],
|
||||
icon="fa-trophy",
|
||||
alerts_possible=True,
|
||||
),
|
||||
@@ -92,7 +92,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
|
||||
description="Summits on the Air",
|
||||
sig_type=ActivityType.ADVENTURE,
|
||||
has_refs=True,
|
||||
refs_globally_unique=False,
|
||||
refs_globally_unique=True,
|
||||
ref_type=ActivityRefType.SUMMIT,
|
||||
ref_regex=r"[A-Z0-9]{1,3}\/[A-Z]{2}\-\d{3}",
|
||||
comment_names=["SOTA"],
|
||||
@@ -150,9 +150,9 @@ ACTIVITIES: dict[ActivityName, Activity] = {
|
||||
description="Islands on the Air",
|
||||
sig_type=ActivityType.ADVENTURE,
|
||||
has_refs=True,
|
||||
refs_globally_unique=False,
|
||||
refs_globally_unique=True,
|
||||
ref_type=ActivityRefType.ISLAND,
|
||||
ref_regex=r"[A-Z]{2}\-\d{3}",
|
||||
ref_regex=r"(?:AF|AN|AS|EU|NA|OC|SA)\-\d{3}",
|
||||
comment_names=["IOTA"],
|
||||
icon="fa-book-atlas",
|
||||
),
|
||||
@@ -163,7 +163,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
|
||||
has_refs=True,
|
||||
refs_globally_unique=False,
|
||||
ref_type=ActivityRefType.ISLAND,
|
||||
ref_regex=r"(([A-Z]{2}\-\d{3})|([A-Z0-9]{1,3}\/[A-Z]{2}\-\d{3}))",
|
||||
ref_regex=r"(?:(?:[A-Z]{2}\-\d{3})|(?:[A-Z0-9]{1,3}\/[A-Z]{2}\-\d{3}))",
|
||||
comment_names=[],
|
||||
icon="fa-person-hiking",
|
||||
),
|
||||
@@ -386,7 +386,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
|
||||
# FEA references are technically [DE]\-\d{4}(\.\d)? but spotters always seem to miss out the D- or E-
|
||||
# prefix and just use FEA-1234 or FEA 1234, so allow for that. The FEA activity ref data provider adds both
|
||||
# forms to the database.
|
||||
ref_regex=r"([DE]|FEA)[\- ]\d{4}(\.\d)?",
|
||||
ref_regex=r"(?:[DE]|FEA)[\- ]\d{4}(?:\.\d)?",
|
||||
comment_names=["FEA"],
|
||||
icon="fa-house-flood-water",
|
||||
region_flag="🇪🇸",
|
||||
|
||||
+20
-9
@@ -359,20 +359,20 @@ class Spot:
|
||||
# These are common on cluster spots and can provide grid references in preference to e.g. QRZ lookup, as well as
|
||||
# being the only source we have for propagation mode. Brace for nightmare regex from hell.
|
||||
if self.comment:
|
||||
grid_mode_grid_match = re.search(
|
||||
grid_match = re.search(
|
||||
r"\b([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)(?:<([^>]*)>|\(([^)]*)\))([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\b",
|
||||
self.comment,
|
||||
)
|
||||
if grid_mode_grid_match:
|
||||
if grid_match:
|
||||
# regex matches, so extract grids:
|
||||
if not self.de_grid:
|
||||
self.de_grid = grid_mode_grid_match.group(1).upper()
|
||||
self.de_grid = grid_match.group(1).upper()
|
||||
if not self.dx_grid:
|
||||
self.dx_grid = grid_mode_grid_match.group(4).upper()
|
||||
self.dx_grid = grid_match.group(4).upper()
|
||||
self.dx_location_source = LocationSourceForSpot.GRID
|
||||
|
||||
# And extract propagation mode (group 2 for <...>, group 3 for (...)):
|
||||
mode_tag = (grid_mode_grid_match.group(2) or grid_mode_grid_match.group(3) or "").upper()
|
||||
mode_tag = (grid_match.group(2) or grid_match.group(3) or "").upper()
|
||||
if mode_tag and not self.propagation_mode:
|
||||
if mode_tag in PROPAGATION_MODES:
|
||||
self.propagation_mode = PROPAGATION_MODES[mode_tag]
|
||||
@@ -386,6 +386,17 @@ class Spot:
|
||||
if self.propagation_mode == "Earth-Moon-Earth" and not self.sig:
|
||||
self.sig = ActivityName.EME
|
||||
|
||||
# Parse 6-digit grid structures from the comment if the frequency is VHF or above, as it's common to see
|
||||
# VHF+ operators spotted with their grid
|
||||
if self.comment and self.freq and self.freq > 30000000:
|
||||
grid_match = re.search(
|
||||
r"\b([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\b",
|
||||
self.comment,
|
||||
)
|
||||
if grid_match and not self.dx_grid:
|
||||
self.dx_grid = grid_match.group(1).upper()
|
||||
self.dx_location_source = LocationSourceForSpot.GRID
|
||||
|
||||
# Set activities based on the DX callsign suffix
|
||||
if self.dx_call and not self.sig:
|
||||
if self.dx_call.upper().endswith(ActivityName.AERONAUTICAL_MOBILE):
|
||||
@@ -411,17 +422,17 @@ class Spot:
|
||||
|
||||
# Parse "de_grid -> dx_grid" structures from the comment
|
||||
if self.comment:
|
||||
grid_mode_grid_match = re.search(
|
||||
grid_match = re.search(
|
||||
r"\b([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\s*->\s*([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\b",
|
||||
self.comment,
|
||||
)
|
||||
if grid_mode_grid_match:
|
||||
if grid_match:
|
||||
# regex matches, so extract grids:
|
||||
if not self.dx_grid:
|
||||
self.dx_grid = grid_mode_grid_match.group(1).upper()
|
||||
self.dx_grid = grid_match.group(1).upper()
|
||||
self.dx_location_source = LocationSourceForSpot.GRID
|
||||
if not self.de_grid:
|
||||
self.de_grid = grid_mode_grid_match.group(2).upper()
|
||||
self.de_grid = grid_match.group(2).upper()
|
||||
|
||||
# DX Grid to lat/lon and vice versa in case one is missing
|
||||
if self.dx_grid and (not self.dx_latitude or not self.dx_longitude):
|
||||
|
||||
+16
-13
@@ -98,24 +98,27 @@ class GMA(HTTPSpotProvider):
|
||||
and ref_response.text != "\n"
|
||||
):
|
||||
ref_info = ref_response.json()
|
||||
# If this is POTA, SOTA or WWFF data we already have it through other means, so ignore. POTA and WWFF
|
||||
# spots come through with reftype=POTA or reftype=WWFF. SOTA is harder to figure out because both SOTA
|
||||
# and GMA summits come through with reftype=Summit, so we must check for the presence of a "sota" entry
|
||||
# to determine if it's a SOTA summit.
|
||||
if (
|
||||
spot.sig_refs
|
||||
and ref_info
|
||||
and "reftype" in ref_info
|
||||
and ref_info["reftype"] not in [ActivityName.POTA, ActivityName.WWFF]
|
||||
and (
|
||||
ref_info["reftype"] != "Summit" or "sota" not in ref_info or ref_info["sota"] == ""
|
||||
)
|
||||
):
|
||||
if spot.sig_refs and ref_info and "reftype" in ref_info:
|
||||
match ref_info["reftype"]:
|
||||
case "Summit":
|
||||
# Summits are a bit complicated, they can be SOTA or GMA depending on the
|
||||
# separate "sota" field:
|
||||
if "sota" in ref_info and ref_info["sota"] != "":
|
||||
spot.sig_refs[0].sig = ActivityName.SOTA
|
||||
spot.sig_refs[0].ref_type = ActivityRefType.SUMMIT
|
||||
spot.sig = ActivityName.SOTA
|
||||
else:
|
||||
spot.sig_refs[0].sig = ActivityName.GMA
|
||||
spot.sig_refs[0].ref_type = ActivityRefType.SUMMIT
|
||||
spot.sig = ActivityName.GMA
|
||||
case "POTA":
|
||||
spot.sig_refs[0].sig = ActivityName.POTA
|
||||
spot.sig_refs[0].ref_type = ActivityRefType.PARK
|
||||
spot.sig = ActivityName.POTA
|
||||
case "WWFF":
|
||||
spot.sig_refs[0].sig = ActivityName.WWFF
|
||||
spot.sig_refs[0].ref_type = ActivityRefType.PARK
|
||||
spot.sig = ActivityName.WWFF
|
||||
case "IOTA Island":
|
||||
spot.sig_refs[0].sig = ActivityName.IOTA
|
||||
spot.sig_refs[0].ref_type = ActivityRefType.ISLAND
|
||||
|
||||
@@ -68,21 +68,33 @@ class ParksNPeaks(HTTPSpotProvider):
|
||||
# Record activity information
|
||||
activity = source_spot["actClass"].upper()
|
||||
ref_id = source_spot["actSiteID"]
|
||||
|
||||
if activity:
|
||||
spot.sig = activity
|
||||
activity_refs = []
|
||||
|
||||
if ref_id:
|
||||
activity_refs = [
|
||||
ActivityRef(
|
||||
id=source_spot["actSiteID"],
|
||||
id=ref_id,
|
||||
sig=activity,
|
||||
# Free text location is not present in all spots, so only add it if it's set
|
||||
name=source_spot["actLocation"]
|
||||
if "actLocation" in source_spot and source_spot["actLocation"] != ""
|
||||
else None,
|
||||
)
|
||||
]
|
||||
spot.sig_refs = activity_refs
|
||||
|
||||
# Free text location is not present in all spots, so only add it if it's set
|
||||
if "actLocation" in source_spot and source_spot["actLocation"] != "":
|
||||
activity_refs[0].name = source_spot["actLocation"]
|
||||
else:
|
||||
# If no actSiteID is set, e.g. because actClass is "QRP", sometimes we still have an actLocation
|
||||
# which is free text like "SOTA G/SC-001". If we have that, and not a normal comment field, use
|
||||
# that location as the comment field so the information doesn't get lost.
|
||||
if (
|
||||
"actLocation" in source_spot
|
||||
and source_spot["actLocation"] != ""
|
||||
and ("actComments" not in source_spot or source_spot["actComments"] == "")
|
||||
):
|
||||
spot.comment = source_spot["actLocation"]
|
||||
|
||||
# Log a warning for the developer if PnP gives us an unknown programme we've never seen before
|
||||
if activity not in [
|
||||
@@ -95,8 +107,11 @@ class ParksNPeaks(HTTPSpotProvider):
|
||||
ActivityName.KRMNPA,
|
||||
ActivityName.SANPCPA,
|
||||
ActivityName.LLOTA,
|
||||
ActivityName.QRP,
|
||||
]:
|
||||
logger.warning(f"PNP spot found with activity {activity}, developer needs to add support for this!")
|
||||
logger.warning(
|
||||
f"PNP spot found with activity {activity}, developer needs to add support for this!"
|
||||
)
|
||||
|
||||
# Add new spot to the list
|
||||
new_spots.append(spot)
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/static/js/add-spot.js?v=1789894090"></script>
|
||||
<script src="/static/js/add-spot.js?v=1789896773"></script>
|
||||
<script>$(document).ready(function () {
|
||||
$("#nav-link-add-spot").addClass("active");
|
||||
}); <!-- highlight active page in nav --></script>
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/static/js/alerts.js?v=1789894090"></script>
|
||||
<script src="/static/js/alerts.js?v=1789896773"></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=1789894090"></script>
|
||||
<script src="/static/js/bands.js?v=1789894090"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1789896773"></script>
|
||||
<script src="/static/js/bands.js?v=1789896773"></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=1789894090" type="text/css">
|
||||
<link rel="stylesheet" href="/static/css/style.css?v=1789896773" 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">
|
||||
@@ -16,10 +16,10 @@
|
||||
window.fetchEventSource = fetchEventSource;
|
||||
</script>
|
||||
|
||||
<script src="/static/js/utils.js?v=1789894090"></script>
|
||||
<script src="/static/js/ui-ham.js?v=1789894090"></script>
|
||||
<script src="/static/js/geo.js?v=1789894090"></script>
|
||||
<script src="/static/js/common.js?v=1789894090"></script>
|
||||
<script src="/static/js/utils.js?v=1789896773"></script>
|
||||
<script src="/static/js/ui-ham.js?v=1789896773"></script>
|
||||
<script src="/static/js/geo.js?v=1789896773"></script>
|
||||
<script src="/static/js/common.js?v=1789896773"></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=1789894090"></script>
|
||||
<script src="/static/js/conditions.js?v=1789896773"></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=1789894090"></script>
|
||||
<script src="/static/js/map.js?v=1789894090"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1789896773"></script>
|
||||
<script src="/static/js/map.js?v=1789896773"></script>
|
||||
<script>$(document).ready(function () {
|
||||
$("#nav-link-map").addClass("active");
|
||||
}); <!-- highlight active page in nav --></script>
|
||||
|
||||
@@ -125,8 +125,8 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1789894090"></script>
|
||||
<script src="/static/js/spots.js?v=1789894090"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1789896773"></script>
|
||||
<script src="/static/js/spots.js?v=1789896773"></script>
|
||||
<script>$(document).ready(function () {
|
||||
$("#nav-link-spots").addClass("active");
|
||||
}); <!-- highlight active page in nav --></script>
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/static/js/status.js?v=1789894090"></script>
|
||||
<script src="/static/js/status.js?v=1789896773"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#nav-link-status").addClass("active");
|
||||
|
||||
Reference in New Issue
Block a user