mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 14:27:42 +00:00
Improve handling of GMA SOTA spots, SOTA references in comments, and grids in comments on VHF
This commit is contained in:
+1
-1
@@ -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"],
|
||||
|
||||
+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):
|
||||
|
||||
+19
-16
@@ -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":
|
||||
spot.sig_refs[0].sig = ActivityName.GMA
|
||||
spot.sig_refs[0].ref_type = ActivityRefType.SUMMIT
|
||||
spot.sig = ActivityName.GMA
|
||||
# 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
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/static/js/add-spot.js?v=1789895439"></script>
|
||||
<script src="/static/js/add-spot.js?v=1789896308"></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=1789895439"></script>
|
||||
<script src="/static/js/alerts.js?v=1789896308"></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=1789895439"></script>
|
||||
<script src="/static/js/bands.js?v=1789895439"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1789896308"></script>
|
||||
<script src="/static/js/bands.js?v=1789896308"></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=1789895439" type="text/css">
|
||||
<link rel="stylesheet" href="/static/css/style.css?v=1789896308" 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=1789895439"></script>
|
||||
<script src="/static/js/ui-ham.js?v=1789895439"></script>
|
||||
<script src="/static/js/geo.js?v=1789895439"></script>
|
||||
<script src="/static/js/common.js?v=1789895439"></script>
|
||||
<script src="/static/js/utils.js?v=1789896308"></script>
|
||||
<script src="/static/js/ui-ham.js?v=1789896308"></script>
|
||||
<script src="/static/js/geo.js?v=1789896308"></script>
|
||||
<script src="/static/js/common.js?v=1789896308"></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=1789895439"></script>
|
||||
<script src="/static/js/conditions.js?v=1789896308"></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=1789895439"></script>
|
||||
<script src="/static/js/map.js?v=1789895439"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1789896308"></script>
|
||||
<script src="/static/js/map.js?v=1789896308"></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=1789895439"></script>
|
||||
<script src="/static/js/spots.js?v=1789895439"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1789896308"></script>
|
||||
<script src="/static/js/spots.js?v=1789896308"></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=1789895439"></script>
|
||||
<script src="/static/js/status.js?v=1789896308"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#nav-link-status").addClass("active");
|
||||
|
||||
Reference in New Issue
Block a user