mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Compare commits
7 Commits
ae72649df8
...
53977c5306
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53977c5306 | ||
|
|
15c216c5e0 | ||
|
|
e2e5eb0b8b | ||
|
|
1a7427ad36 | ||
|
|
86f2aed673 | ||
|
|
20977e59cf | ||
|
|
a21782cb62 |
@@ -4,6 +4,7 @@ from datetime import datetime
|
|||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
from alertproviders.http_alert_provider import HTTPAlertProvider
|
from alertproviders.http_alert_provider import HTTPAlertProvider
|
||||||
|
from core.sig_utils import get_icon_for_sig
|
||||||
from data.alert import Alert
|
from data.alert import Alert
|
||||||
|
|
||||||
|
|
||||||
@@ -39,24 +40,13 @@ class ParksNPeaks(HTTPAlertProvider):
|
|||||||
sig=source_alert["Class"],
|
sig=source_alert["Class"],
|
||||||
sig_refs=[sig_ref],
|
sig_refs=[sig_ref],
|
||||||
sig_refs_names=[sig_ref_name],
|
sig_refs_names=[sig_ref_name],
|
||||||
|
icon=get_icon_for_sig(source_alert["Class"]),
|
||||||
start_time=start_time,
|
start_time=start_time,
|
||||||
is_dxpedition=False)
|
is_dxpedition=False)
|
||||||
|
|
||||||
# PNP supports a bunch of programs which should have different icons
|
# Log a warning for the developer if PnP gives us an unknown programme we've never seen before
|
||||||
if alert.sig == "SiOTA":
|
if alert.sig not in ["POTA", "SOTA", "WWFF", "SiOTA", "ZLOTA", "KRMNPA"]:
|
||||||
alert.icon = "wheat-awn"
|
logging.warn("PNP alert found with sig " + alert.sig + ", developer needs to add support for this!")
|
||||||
elif alert.sig == "ZLOTA":
|
|
||||||
alert.icon = "kiwi-bird"
|
|
||||||
elif alert.sig == "KRMNPA":
|
|
||||||
alert.icon = "earth-oceania"
|
|
||||||
elif alert.sig in ["POTA", "SOTA", "WWFF"]:
|
|
||||||
# Don't care about an icon as this will be rejected anyway, we have better data from POTA/SOTA/WWFF direct
|
|
||||||
alert.icon = ""
|
|
||||||
else:
|
|
||||||
# Unknown programme we've never seen before
|
|
||||||
logging.warn(
|
|
||||||
"PNP alert found with sig " + alert.sig + ", developer needs to add support for this and set an icon!")
|
|
||||||
alert.icon = "question"
|
|
||||||
|
|
||||||
# If this is POTA, SOTA or WWFF data we already have it through other means, so ignore. Otherwise, add to
|
# If this is POTA, SOTA or WWFF data we already have it through other means, so ignore. Otherwise, add to
|
||||||
# the alert list.
|
# the alert list.
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from datetime import datetime
|
|||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
from alertproviders.http_alert_provider import HTTPAlertProvider
|
from alertproviders.http_alert_provider import HTTPAlertProvider
|
||||||
|
from core.sig_utils import get_icon_for_sig
|
||||||
from data.alert import Alert
|
from data.alert import Alert
|
||||||
|
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ class POTA(HTTPAlertProvider):
|
|||||||
sig="POTA",
|
sig="POTA",
|
||||||
sig_refs=[source_alert["reference"]],
|
sig_refs=[source_alert["reference"]],
|
||||||
sig_refs_names=[source_alert["name"]],
|
sig_refs_names=[source_alert["name"]],
|
||||||
icon="tree",
|
icon=get_icon_for_sig("POTA"),
|
||||||
start_time=datetime.strptime(source_alert["startDate"] + source_alert["startTime"],
|
start_time=datetime.strptime(source_alert["startDate"] + source_alert["startTime"],
|
||||||
"%Y-%m-%d%H:%M").replace(tzinfo=pytz.UTC).timestamp(),
|
"%Y-%m-%d%H:%M").replace(tzinfo=pytz.UTC).timestamp(),
|
||||||
end_time=datetime.strptime(source_alert["endDate"] + source_alert["endTime"],
|
end_time=datetime.strptime(source_alert["endDate"] + source_alert["endTime"],
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from datetime import datetime
|
|||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
from alertproviders.http_alert_provider import HTTPAlertProvider
|
from alertproviders.http_alert_provider import HTTPAlertProvider
|
||||||
|
from core.sig_utils import get_icon_for_sig
|
||||||
from data.alert import Alert
|
from data.alert import Alert
|
||||||
|
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ class SOTA(HTTPAlertProvider):
|
|||||||
sig="SOTA",
|
sig="SOTA",
|
||||||
sig_refs=[source_alert["associationCode"] + "/" + source_alert["summitCode"]],
|
sig_refs=[source_alert["associationCode"] + "/" + source_alert["summitCode"]],
|
||||||
sig_refs_names=[source_alert["summitDetails"]],
|
sig_refs_names=[source_alert["summitDetails"]],
|
||||||
icon="mountain-sun",
|
icon=get_icon_for_sig("SOTA"),
|
||||||
start_time=datetime.strptime(source_alert["dateActivated"],
|
start_time=datetime.strptime(source_alert["dateActivated"],
|
||||||
"%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=pytz.UTC).timestamp(),
|
"%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=pytz.UTC).timestamp(),
|
||||||
is_dxpedition=False)
|
is_dxpedition=False)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from datetime import datetime
|
|||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
from alertproviders.http_alert_provider import HTTPAlertProvider
|
from alertproviders.http_alert_provider import HTTPAlertProvider
|
||||||
|
from core.sig_utils import get_icon_for_sig
|
||||||
from data.alert import Alert
|
from data.alert import Alert
|
||||||
|
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ class WWFF(HTTPAlertProvider):
|
|||||||
comment=source_alert["remarks"],
|
comment=source_alert["remarks"],
|
||||||
sig="WWFF",
|
sig="WWFF",
|
||||||
sig_refs=[source_alert["reference"]],
|
sig_refs=[source_alert["reference"]],
|
||||||
icon="seedling",
|
icon=get_icon_for_sig("WWFF"),
|
||||||
start_time=datetime.strptime(source_alert["utc_start"],
|
start_time=datetime.strptime(source_alert["utc_start"],
|
||||||
"%Y-%m-%d %H:%M:%S").replace(tzinfo=pytz.UTC).timestamp(),
|
"%Y-%m-%d %H:%M:%S").replace(tzinfo=pytz.UTC).timestamp(),
|
||||||
end_time=datetime.strptime(source_alert["utc_end"],
|
end_time=datetime.strptime(source_alert["utc_end"],
|
||||||
|
|||||||
@@ -1,15 +1,33 @@
|
|||||||
from core.config import SERVER_OWNER_CALLSIGN
|
from core.config import SERVER_OWNER_CALLSIGN
|
||||||
from data.band import Band
|
from data.band import Band
|
||||||
|
from data.sig import SIG
|
||||||
|
|
||||||
# General software
|
# General software
|
||||||
SOFTWARE_NAME = "Spothole by M0TRT"
|
SOFTWARE_NAME = "Spothole by M0TRT"
|
||||||
SOFTWARE_VERSION = "0.1"
|
SOFTWARE_VERSION = "0.1"
|
||||||
|
|
||||||
# HTTP headers used for spot providers that use HTTP
|
# HTTP headers used for spot providers that use HTTP
|
||||||
HTTP_HEADERS = {"User-Agent": SOFTWARE_NAME + " " + SOFTWARE_VERSION + " (operated by " + SERVER_OWNER_CALLSIGN + ")"}
|
HTTP_HEADERS = {"User-Agent": SOFTWARE_NAME + ", v" + SOFTWARE_VERSION + " (operated by " + SERVER_OWNER_CALLSIGN + ")"}
|
||||||
|
|
||||||
# Special Interest Groups
|
# Special Interest Groups
|
||||||
SIGS = ["POTA", "SOTA", "WWFF", "GMA", "WWBOTA", "HEMA", "MOTA", "ARLHS", "ILLW", "SiOTA", "WCA", "ZLOTA", "IOTA", "KRMNPA"]
|
SIGS = [
|
||||||
|
SIG(name="POTA", description="Parks on the Air", icon="tree", ref_regex=r"[A-Z]{2}\-\d+"),
|
||||||
|
SIG(name="SOTA", description="Summits on the Air", icon="mountain-sun", ref_regex=r"[A-Z0-9]{1,3}\/[A-Z]{2}\-\d+"),
|
||||||
|
SIG(name="WWFF", description="World Wide Flora & Fauna", icon="seedling", ref_regex=r"[A-Z0-9]{1,3}FF\-\d+"),
|
||||||
|
SIG(name="GMA", description="Global Mountain Activity", icon="person-hiking", ref_regex=r"[A-Z0-9]{1,3}\/[A-Z]{2}\-\d+"),
|
||||||
|
SIG(name="WWBOTA", description="Worldwide Bunkers on the Air", icon="radiation", ref_regex=r"B\/[A-Z0-9]{1,3}\-\d+"),
|
||||||
|
SIG(name="HEMA", description="HuMPs Excluding Marilyns Award", icon="mound", ref_regex=r"[A-Z0-9]{1,3}\/[A-Z]{3}\-\d+"),
|
||||||
|
SIG(name="IOTA", description="Islands on the Air", icon="umbrella-beach", ref_regex=r"[A-Z]{2}\-\d+"),
|
||||||
|
SIG(name="MOTA", description="Mills on the Air", icon="fan", ref_regex=r"X\d{4-6}"),
|
||||||
|
SIG(name="ARLHS", description="Amateur Radio Lighthouse Society", icon="tower-observation", ref_regex=r"[A-Z]{3}\-\d+"),
|
||||||
|
SIG(name="ILLW", description="International Lighthouse & Lightship Weekend", icon="tower-observation", ref_regex=r"[A-Z]{2}\d{4}"),
|
||||||
|
SIG(name="SIOTA", description="Silos on the Air", icon="wheat-awn", ref_regex=r"[A-Z]{2}\-[A-Z]{3}\d"),
|
||||||
|
SIG(name="WCA", description="World Castles Award", icon="chess-rook", ref_regex=r"[A-Z0-9]{1,3}\-\d+"),
|
||||||
|
SIG(name="ZLOTA", description="New Zealand on the Air", icon="kiwi-bird", ref_regex=r"ZL[A-Z]/[A-Z]{2}\-\d+"),
|
||||||
|
SIG(name="KRMNPA", description="Keith Roget Memorial National Parks Award", icon="earth-oceania", ref_regex=r""),
|
||||||
|
SIG(name="WAB", description="Worked All Britain", icon="table-cells-large", ref_regex=r"[A-Z]{1,2}[0-9]{2}"),
|
||||||
|
SIG(name="WAI", description="Worked All Ireland", icon="table-cells-large", ref_regex=r"[A-Z][0-9]{2}")
|
||||||
|
]
|
||||||
|
|
||||||
# Modes. Note "DIGI" and "DIGITAL" are also supported but are normalised into "DATA".
|
# Modes. Note "DIGI" and "DIGITAL" are also supported but are normalised into "DATA".
|
||||||
CW_MODES = ["CW"]
|
CW_MODES = ["CW"]
|
||||||
|
|||||||
103
core/geo_utils.py
Normal file
103
core/geo_utils.py
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
import logging
|
||||||
|
import re
|
||||||
|
from math import floor
|
||||||
|
|
||||||
|
from pyproj import Transformer
|
||||||
|
|
||||||
|
TRANSFORMER_OS_GRID_TO_WGS84 = Transformer.from_crs("EPSG:27700", "EPSG:4326")
|
||||||
|
TRANSFORMER_IRISH_GRID_TO_WGS84 = Transformer.from_crs("EPSG:29903", "EPSG:4326")
|
||||||
|
TRANSFORMER_CI_UTM_GRID_TO_WGS84 = Transformer.from_crs("+proj=utm +zone=30 +ellps=WGS84", "EPSG:4326")
|
||||||
|
|
||||||
|
|
||||||
|
# Convert a Worked All Britain or Worked All Ireland reference to a lat/lon point.
|
||||||
|
def wab_wai_square_to_lat_lon(ref):
|
||||||
|
# First check we have a valid grid square, and based on what it looks like, use either the Ordnance Survey, Irish,
|
||||||
|
# or UTM grid systems to perform the conversion.
|
||||||
|
if re.match(r"^[HNOST][ABCDEFGHJKLMNOPQRSTUVWXYZ][0-9]{2}$", ref):
|
||||||
|
return os_grid_square_to_lat_lon(ref)
|
||||||
|
elif re.match(r"^[ABCDEFGHJKLMNOPQRSTUVWXYZ][0-9]{2}$", ref):
|
||||||
|
return irish_grid_square_to_lat_lon(ref)
|
||||||
|
elif re.match(r"^W[AV][0-9]{2}$", ref):
|
||||||
|
return utm_grid_square_to_lat_lon(ref)
|
||||||
|
else:
|
||||||
|
logging.warn("Invalid WAB/WAI square: " + ref)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
# Get a lat/lon point for the centre of an Ordnance Survey grid square
|
||||||
|
def os_grid_square_to_lat_lon(ref):
|
||||||
|
# Convert the letters into multipliers for the 500km squares and 100km squares
|
||||||
|
offset_500km_multiplier = ord(ref[0]) - 65
|
||||||
|
offset_100km_multiplier = ord(ref[1]) - 65
|
||||||
|
|
||||||
|
# The letter "I" is not used in the grid, so any offset of 8 or more needs to be reduced by 1.
|
||||||
|
if offset_500km_multiplier >= 8:
|
||||||
|
offset_500km_multiplier = offset_500km_multiplier - 1
|
||||||
|
if offset_100km_multiplier >= 8:
|
||||||
|
offset_100km_multiplier = offset_100km_multiplier - 1
|
||||||
|
|
||||||
|
# Convert the offsets into increments of 100km from the false origin (grid square SV):
|
||||||
|
easting_100km = ((offset_500km_multiplier - 2) % 5) * 5 + (offset_100km_multiplier % 5)
|
||||||
|
northing_100km = (19 - floor(offset_500km_multiplier / 5) * 5) - floor(offset_100km_multiplier / 5)
|
||||||
|
|
||||||
|
# Take the numeric parts of the grid square and multiply by 10000 to get metres, then combine with the 100km
|
||||||
|
# box offsets
|
||||||
|
easting = int(ref[2]) * 10000 + easting_100km * 100000
|
||||||
|
northing = int(ref[3]) * 10000 + northing_100km * 100000
|
||||||
|
|
||||||
|
# Add 5000m to each value to get the middle of the box rather than the south-west corner
|
||||||
|
easting = easting + 5000
|
||||||
|
northing = northing + 5000
|
||||||
|
|
||||||
|
# Reproject to WGS84 lat/lon
|
||||||
|
lat, lon = TRANSFORMER_OS_GRID_TO_WGS84.transform(easting, northing)
|
||||||
|
return lat, lon
|
||||||
|
|
||||||
|
|
||||||
|
# Get a lat/lon point for the centre of an Irish Grid square.
|
||||||
|
def irish_grid_square_to_lat_lon(ref):
|
||||||
|
# Convert the letters into multipliers for the 100km squares
|
||||||
|
offset_100km_multiplier = ord(ref[0]) - 65
|
||||||
|
|
||||||
|
# The letter "I" is not used in the grid, so any offset of 8 or more needs to be reduced by 1.
|
||||||
|
if offset_100km_multiplier >= 8:
|
||||||
|
offset_100km_multiplier = offset_100km_multiplier - 1
|
||||||
|
|
||||||
|
# Convert the offsets into increments of 100km from the false origin:
|
||||||
|
easting_100km = offset_100km_multiplier % 5
|
||||||
|
northing_100km = 4 - floor(offset_100km_multiplier / 5)
|
||||||
|
|
||||||
|
# Take the numeric parts of the grid square and multiply by 10000 to get metres, then combine with the 100km
|
||||||
|
# box offsets
|
||||||
|
easting = int(ref[1]) * 10000 + easting_100km * 100000
|
||||||
|
northing = int(ref[2]) * 10000 + northing_100km * 100000
|
||||||
|
|
||||||
|
# Add 5000m to each value to get the middle of the box rather than the south-west corner
|
||||||
|
easting = easting + 5000
|
||||||
|
northing = northing + 5000
|
||||||
|
|
||||||
|
# Reproject to WGS84 lat/lon
|
||||||
|
lat, lon = TRANSFORMER_IRISH_GRID_TO_WGS84.transform(easting, northing)
|
||||||
|
return lat, lon
|
||||||
|
|
||||||
|
|
||||||
|
# Get a lat/lon point for the centre of a UTM grid square (supports only squares WA & WV for the Channel Islands, nothing else implemented)
|
||||||
|
def utm_grid_square_to_lat_lon(ref):
|
||||||
|
# Take the numeric parts of the grid square and multiply by 10000 to get metres from the corner of the letter-based grid square
|
||||||
|
easting = int(ref[2]) * 10000
|
||||||
|
northing = int(ref[3]) * 10000
|
||||||
|
|
||||||
|
# Apply the appropriate offset based on whether the square is WA or WV
|
||||||
|
easting = easting + 500000
|
||||||
|
if ref[1] == "A":
|
||||||
|
northing = northing + 5500000
|
||||||
|
else:
|
||||||
|
northing = northing + 5400000
|
||||||
|
|
||||||
|
# Add 5000m to each value to get the middle of the box rather than the south-west corner
|
||||||
|
easting = easting + 5000
|
||||||
|
northing = northing + 5000
|
||||||
|
|
||||||
|
# Reproject to WGS84 lat/lon
|
||||||
|
lat, lon = TRANSFORMER_CI_UTM_GRID_TO_WGS84.transform(easting, northing)
|
||||||
|
return lat, lon
|
||||||
21
core/sig_utils.py
Normal file
21
core/sig_utils.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
from core.constants import SIGS
|
||||||
|
|
||||||
|
# Utility function to get the icon for a named SIG. If no match is found, the "circle-question" icon will be returned.
|
||||||
|
def get_icon_for_sig(sig):
|
||||||
|
for s in SIGS:
|
||||||
|
if s.name == sig:
|
||||||
|
return s.icon
|
||||||
|
return "circle-question"
|
||||||
|
|
||||||
|
# Utility function to get the regex string for a SIG reference for a named SIG. If no match is found, None will be returned.
|
||||||
|
def get_ref_regex_for_sig(sig):
|
||||||
|
for s in SIGS:
|
||||||
|
if s.name == sig:
|
||||||
|
return s.ref_regex
|
||||||
|
return None
|
||||||
|
|
||||||
|
# Regex matching any SIG
|
||||||
|
ANY_SIG_REGEX = r"(" + r"|".join(list(map(lambda p: p.name, SIGS))) + r")"
|
||||||
|
|
||||||
|
# Regex matching any SIG reference
|
||||||
|
ANY_XOTA_SIG_REF_REGEX = r"[\w\/]+\-\d+"
|
||||||
@@ -9,6 +9,7 @@ import pytz
|
|||||||
|
|
||||||
from core.constants import DXCC_FLAGS
|
from core.constants import DXCC_FLAGS
|
||||||
from core.lookup_helper import lookup_helper
|
from core.lookup_helper import lookup_helper
|
||||||
|
from core.sig_utils import get_icon_for_sig
|
||||||
|
|
||||||
|
|
||||||
# Data class that defines an alert.
|
# Data class that defines an alert.
|
||||||
@@ -59,7 +60,7 @@ class Alert:
|
|||||||
# Activation score. SOTA only
|
# Activation score. SOTA only
|
||||||
activation_score: int = None
|
activation_score: int = None
|
||||||
# Icon, from the Font Awesome set. This is fairly opinionated but is here to help the alerthole web UI and Field alertter. Does not include the "fa-" prefix.
|
# Icon, from the Font Awesome set. This is fairly opinionated but is here to help the alerthole web UI and Field alertter. Does not include the "fa-" prefix.
|
||||||
icon: str = "question"
|
icon: str = None
|
||||||
# Whether this alert is for a DXpedition, as opposed to e.g. an xOTA programme.
|
# Whether this alert is for a DXpedition, as opposed to e.g. an xOTA programme.
|
||||||
is_dxpedition: bool = False
|
is_dxpedition: bool = False
|
||||||
# Where we got the alert from, e.g. "POTA", "SOTA"...
|
# Where we got the alert from, e.g. "POTA", "SOTA"...
|
||||||
@@ -100,6 +101,10 @@ class Alert:
|
|||||||
if self.dx_dxcc_id and self.dx_dxcc_id in DXCC_FLAGS and not self.dx_flag:
|
if self.dx_dxcc_id and self.dx_dxcc_id in DXCC_FLAGS and not self.dx_flag:
|
||||||
self.dx_flag = DXCC_FLAGS[self.dx_dxcc_id]
|
self.dx_flag = DXCC_FLAGS[self.dx_dxcc_id]
|
||||||
|
|
||||||
|
# Icon from SIG
|
||||||
|
if self.sig and not self.icon:
|
||||||
|
self.icon = get_icon_for_sig(self.sig)
|
||||||
|
|
||||||
# DX operator details lookup, using QRZ.com. This should be the last resort compared to taking the data from
|
# DX operator details lookup, using QRZ.com. This should be the last resort compared to taking the data from
|
||||||
# the actual alertting service, e.g. we don't want to accidentally use a user's QRZ.com home lat/lon instead of
|
# the actual alertting service, e.g. we don't want to accidentally use a user's QRZ.com home lat/lon instead of
|
||||||
# the one from the park reference they're at.
|
# the one from the park reference they're at.
|
||||||
|
|||||||
14
data/sig.py
Normal file
14
data/sig.py
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
# Data class that defines a Special Interest Group.
|
||||||
|
@dataclass
|
||||||
|
class SIG:
|
||||||
|
# SIG name, e.g. "POTA"
|
||||||
|
name: str
|
||||||
|
# Description, e.g. "Parks on the Air"
|
||||||
|
description: str
|
||||||
|
# Icon to use for it, from the Font Awesome set. This is fairly opinionated but is here to help the Spothole web UI
|
||||||
|
# and Field Spotter. Does not include the "fa-" prefix.
|
||||||
|
icon: str
|
||||||
|
# Regex matcher for references, e.g. for POTA r"[A-Z]{2}\-\d+".
|
||||||
|
ref_regex: str
|
||||||
43
data/spot.py
43
data/spot.py
@@ -10,7 +10,9 @@ import pytz
|
|||||||
from pyhamtools.locator import locator_to_latlong, latlong_to_locator
|
from pyhamtools.locator import locator_to_latlong, latlong_to_locator
|
||||||
|
|
||||||
from core.constants import DXCC_FLAGS
|
from core.constants import DXCC_FLAGS
|
||||||
|
from core.geo_utils import wab_wai_square_to_lat_lon
|
||||||
from core.lookup_helper import lookup_helper
|
from core.lookup_helper import lookup_helper
|
||||||
|
from core.sig_utils import get_icon_for_sig
|
||||||
|
|
||||||
|
|
||||||
# Data class that defines a spot.
|
# Data class that defines a spot.
|
||||||
@@ -19,7 +21,6 @@ class Spot:
|
|||||||
# Unique identifier for the spot
|
# Unique identifier for the spot
|
||||||
id: str = None
|
id: str = None
|
||||||
|
|
||||||
|
|
||||||
# DX (spotted) operator info
|
# DX (spotted) operator info
|
||||||
|
|
||||||
# Callsign of the operator that has been spotted
|
# Callsign of the operator that has been spotted
|
||||||
@@ -50,12 +51,13 @@ class Spot:
|
|||||||
# lookup
|
# lookup
|
||||||
dx_latitude: float = None
|
dx_latitude: float = None
|
||||||
dx_longitude: float = None
|
dx_longitude: float = None
|
||||||
# DX Location source. Indicates how accurate the location might be. Values: "SPOT", "QRZ, "DXCC", "NONE"
|
# DX Location source. Indicates how accurate the location might be. Values: "SPOT", "WAB/WAI GRID", "QRZ", "DXCC", "NONE"
|
||||||
dx_location_source: str = "NONE"
|
dx_location_source: str = "NONE"
|
||||||
# DX Location good. Indicates that the software thinks the location data is good enough to plot on a map.
|
# DX Location good. Indicates that the software thinks the location data is good enough to plot on a map. This is
|
||||||
|
# true if the location source is "SPOT" or "WAB/WAI GRID", or if the location source is "QRZ" and the DX callsign
|
||||||
|
# doesn't have a suffix like /P.
|
||||||
dx_location_good: bool = False
|
dx_location_good: bool = False
|
||||||
|
|
||||||
|
|
||||||
# DE (Spotter) info
|
# DE (Spotter) info
|
||||||
|
|
||||||
# Callsign of the spotter
|
# Callsign of the spotter
|
||||||
@@ -76,7 +78,6 @@ class Spot:
|
|||||||
de_latitude: float = None
|
de_latitude: float = None
|
||||||
de_longitude: float = None
|
de_longitude: float = None
|
||||||
|
|
||||||
|
|
||||||
# General QSO info
|
# General QSO info
|
||||||
|
|
||||||
# Reported mode, such as SSB, PHONE, CW, FT8...
|
# Reported mode, such as SSB, PHONE, CW, FT8...
|
||||||
@@ -94,7 +95,6 @@ class Spot:
|
|||||||
# QRT state. Some APIs return spots marked as QRT. Otherwise we can check the comments.
|
# QRT state. Some APIs return spots marked as QRT. Otherwise we can check the comments.
|
||||||
qrt: bool = False
|
qrt: bool = False
|
||||||
|
|
||||||
|
|
||||||
# Special Interest Group info
|
# Special Interest Group info
|
||||||
|
|
||||||
# Special Interest Group (SIG), e.g. outdoor activity programme such as POTA
|
# Special Interest Group (SIG), e.g. outdoor activity programme such as POTA
|
||||||
@@ -108,18 +108,16 @@ class Spot:
|
|||||||
# Activation score. SOTA only
|
# Activation score. SOTA only
|
||||||
activation_score: int = None
|
activation_score: int = None
|
||||||
|
|
||||||
|
|
||||||
# Display guidance (optional)
|
# Display guidance (optional)
|
||||||
|
|
||||||
# Icon, from the Font Awesome set. This is fairly opinionated but is here to help the Spothole web UI and Field
|
# Icon, from the Font Awesome set. This is fairly opinionated but is here to help the Spothole web UI and Field
|
||||||
# Spotter. Does not include the "fa-" prefix.
|
# Spotter. Does not include the "fa-" prefix.
|
||||||
icon: str = "question"
|
icon: str = None
|
||||||
# Colour to represent this spot, if a client chooses to colour spots based on their frequency band, using PSK
|
# Colour to represent this spot, if a client chooses to colour spots based on their frequency band, using PSK
|
||||||
# Reporter's default colours. HTML colour e.g. hex. A contrast colour is also provided which will be black or white.
|
# Reporter's default colours. HTML colour e.g. hex. A contrast colour is also provided which will be black or white.
|
||||||
band_color: str = None
|
band_color: str = None
|
||||||
band_contrast_color: str = None
|
band_contrast_color: str = None
|
||||||
|
|
||||||
|
|
||||||
# Timing info
|
# Timing info
|
||||||
|
|
||||||
# Time of the spot, UTC seconds since UNIX epoch
|
# Time of the spot, UTC seconds since UNIX epoch
|
||||||
@@ -133,7 +131,6 @@ class Spot:
|
|||||||
# Time that this software received the spot, ISO 8601
|
# Time that this software received the spot, ISO 8601
|
||||||
received_time_iso: str = None
|
received_time_iso: str = None
|
||||||
|
|
||||||
|
|
||||||
# Source info
|
# Source info
|
||||||
|
|
||||||
# Where we got the spot from, e.g. "POTA", "Cluster"...
|
# Where we got the spot from, e.g. "POTA", "Cluster"...
|
||||||
@@ -218,6 +215,10 @@ class Spot:
|
|||||||
if self.mode and not self.mode_type:
|
if self.mode and not self.mode_type:
|
||||||
self.mode_type = lookup_helper.infer_mode_type_from_mode(self.mode)
|
self.mode_type = lookup_helper.infer_mode_type_from_mode(self.mode)
|
||||||
|
|
||||||
|
# Icon from SIG
|
||||||
|
if self.sig and not self.icon:
|
||||||
|
self.icon = get_icon_for_sig(self.sig)
|
||||||
|
|
||||||
# DX Grid to lat/lon and vice versa
|
# DX Grid to lat/lon and vice versa
|
||||||
if self.dx_grid and not self.dx_latitude:
|
if self.dx_grid and not self.dx_latitude:
|
||||||
ll = locator_to_latlong(self.dx_grid)
|
ll = locator_to_latlong(self.dx_grid)
|
||||||
@@ -231,13 +232,27 @@ class Spot:
|
|||||||
if self.dx_latitude:
|
if self.dx_latitude:
|
||||||
self.dx_location_source = "SPOT"
|
self.dx_location_source = "SPOT"
|
||||||
|
|
||||||
|
# WAB/WAI grid to lat/lon
|
||||||
|
if not self.dx_latitude and self.sig and self.sig_refs and len(self.sig_refs) > 0 and (
|
||||||
|
self.sig == "WAB" or self.sig == "WAI"):
|
||||||
|
ll = wab_wai_square_to_lat_lon(self.sig_refs[0])
|
||||||
|
if ll:
|
||||||
|
self.dx_latitude = ll[0]
|
||||||
|
self.dx_longitude = ll[1]
|
||||||
|
try:
|
||||||
|
self.dx_grid = latlong_to_locator(self.dx_latitude, self.dx_longitude, 8)
|
||||||
|
except:
|
||||||
|
logging.debug("Invalid lat/lon received from WAB/WAI grid")
|
||||||
|
self.dx_location_source = "WAB/WAI GRID"
|
||||||
|
|
||||||
# QRT comment detection
|
# QRT comment detection
|
||||||
if self.comment and not self.qrt:
|
if self.comment and not self.qrt:
|
||||||
self.qrt = "QRT" in self.comment.upper()
|
self.qrt = "QRT" in self.comment.upper()
|
||||||
|
|
||||||
# Clean up comments
|
# Clean up comments
|
||||||
if self.comment:
|
if self.comment:
|
||||||
comment = re.sub(r"\[.*]:", "", self.comment)
|
comment = re.sub(r"\(de [A-Za-z0-9]*\)", "", self.comment)
|
||||||
|
comment = re.sub(r"\[.*]:", "", comment)
|
||||||
comment = re.sub(r"\[.*]", "", comment)
|
comment = re.sub(r"\[.*]", "", comment)
|
||||||
comment = re.sub(r"\"\"", "", comment)
|
comment = re.sub(r"\"\"", "", comment)
|
||||||
self.comment = comment.strip()
|
self.comment = comment.strip()
|
||||||
@@ -266,11 +281,11 @@ class Spot:
|
|||||||
|
|
||||||
# DX Location is "good" if it is from a spot, or from QRZ if the callsign doesn't contain a slash, so the operator
|
# DX Location is "good" if it is from a spot, or from QRZ if the callsign doesn't contain a slash, so the operator
|
||||||
# is likely at home.
|
# is likely at home.
|
||||||
self.dx_location_good = self.dx_location_source == "SPOT" or (
|
self.dx_location_good = self.dx_location_source == "SPOT" or self.dx_location_source == "WAB/WAI GRID" or (
|
||||||
self.dx_location_source == "QRZ" and not "/" in self.dx_call)
|
self.dx_location_source == "QRZ" and not "/" in self.dx_call)
|
||||||
|
|
||||||
# DE of "RBNHOLE" and "SOTAMAT" are not things we can look up location for
|
# DE of "RBNHOLE", "SOTAMAT" and "ZLOTA" are not things we can look up location for
|
||||||
if self.de_call != "RBNHOLE" and self.de_call != "SOTAMAT":
|
if self.de_call != "RBNHOLE" and self.de_call != "SOTAMAT" and self.de_call != "ZLOTA":
|
||||||
# DE operator position lookup, using QRZ.com.
|
# DE operator position lookup, using QRZ.com.
|
||||||
if self.de_call and not self.de_latitude:
|
if self.de_call and not self.de_latitude:
|
||||||
latlon = lookup_helper.infer_latlon_from_callsign_qrz(self.de_call)
|
latlon = lookup_helper.infer_latlon_from_callsign_qrz(self.de_call)
|
||||||
|
|||||||
@@ -10,3 +10,4 @@ diskcache~=5.6.3
|
|||||||
psutil~=7.1.0
|
psutil~=7.1.0
|
||||||
requests-sse~=0.5.2
|
requests-sse~=0.5.2
|
||||||
rss-parser~=2.1.1
|
rss-parser~=2.1.1
|
||||||
|
pyproj~=3.7.2
|
||||||
@@ -7,6 +7,8 @@ from time import sleep
|
|||||||
import pytz
|
import pytz
|
||||||
import telnetlib3
|
import telnetlib3
|
||||||
|
|
||||||
|
from core.constants import SIGS
|
||||||
|
from core.sig_utils import ANY_SIG_REGEX, ANY_XOTA_SIG_REF_REGEX, get_icon_for_sig, get_ref_regex_for_sig
|
||||||
from data.spot import Spot
|
from data.spot import Spot
|
||||||
from core.config import SERVER_OWNER_CALLSIGN
|
from core.config import SERVER_OWNER_CALLSIGN
|
||||||
from spotproviders.spot_provider import SpotProvider
|
from spotproviders.spot_provider import SpotProvider
|
||||||
@@ -75,6 +77,21 @@ class DXCluster(SpotProvider):
|
|||||||
icon="desktop",
|
icon="desktop",
|
||||||
time=spot_datetime.timestamp())
|
time=spot_datetime.timestamp())
|
||||||
|
|
||||||
|
# See if the comment looks like it contains a SIG (and optionally SIG reference). Currently,
|
||||||
|
# only one sig ref is supported. Note that this code is specifically in the DX Cluster class and
|
||||||
|
# not in the general "spot" infer_missing() method. Because we only support one SIG per spot
|
||||||
|
# at the moment (see issue #54), we don't want to risk e.g. a POTA spot with comment "WWFF GFF-0001"
|
||||||
|
# being converted into a WWFF spot.
|
||||||
|
sig_match = re.search(r"(^|\W)" + ANY_SIG_REGEX + r"($|\W)", spot.comment, re.IGNORECASE)
|
||||||
|
if sig_match:
|
||||||
|
spot.sig = sig_match.group(2).upper()
|
||||||
|
spot.icon = get_icon_for_sig(spot.sig)
|
||||||
|
ref_regex = get_ref_regex_for_sig(spot.sig)
|
||||||
|
if ref_regex:
|
||||||
|
sig_ref_match = re.search(r"(^|\W)" + spot.sig + r"($|\W)(" + ref_regex + r")($|\W)", spot.comment, re.IGNORECASE)
|
||||||
|
if sig_ref_match:
|
||||||
|
spot.sig_refs = [sig_ref_match.group(3).upper()]
|
||||||
|
|
||||||
# Add to our list
|
# Add to our list
|
||||||
self.submit(spot)
|
self.submit(spot)
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import pytz
|
|||||||
from requests_cache import CachedSession
|
from requests_cache import CachedSession
|
||||||
|
|
||||||
from core.constants import HTTP_HEADERS
|
from core.constants import HTTP_HEADERS
|
||||||
|
from core.sig_utils import get_icon_for_sig
|
||||||
from data.spot import Spot
|
from data.spot import Spot
|
||||||
from spotproviders.http_spot_provider import HTTPSpotProvider
|
from spotproviders.http_spot_provider import HTTPSpotProvider
|
||||||
|
|
||||||
@@ -57,27 +58,21 @@ class GMA(HTTPSpotProvider):
|
|||||||
match ref_info["reftype"]:
|
match ref_info["reftype"]:
|
||||||
case "Summit":
|
case "Summit":
|
||||||
spot.sig = "GMA"
|
spot.sig = "GMA"
|
||||||
spot.icon = "mountain"
|
|
||||||
case "IOTA Island":
|
case "IOTA Island":
|
||||||
spot.sig = "IOTA"
|
spot.sig = "IOTA"
|
||||||
spot.icon = "umbrella-beach"
|
|
||||||
case "Lighthouse (ILLW)":
|
case "Lighthouse (ILLW)":
|
||||||
spot.sig = "ILLW"
|
spot.sig = "ILLW"
|
||||||
spot.icon = "tower-observation"
|
|
||||||
case "Lighthouse (ARLHS)":
|
case "Lighthouse (ARLHS)":
|
||||||
spot.sig = "ARLHS"
|
spot.sig = "ARLHS"
|
||||||
spot.icon = "tower-observation"
|
|
||||||
case "Castle":
|
case "Castle":
|
||||||
spot.sig = "WCA/COTA"
|
spot.sig = "WCA"
|
||||||
spot.icon = "chess-rook"
|
|
||||||
case "Mill":
|
case "Mill":
|
||||||
spot.sig = "MOTA"
|
spot.sig = "MOTA"
|
||||||
spot.icon = "fan"
|
|
||||||
case _:
|
case _:
|
||||||
logging.warn("GMA spot found with ref type " + ref_info[
|
logging.warn("GMA spot found with ref type " + ref_info[
|
||||||
"reftype"] + ", developer needs to figure out an icon for this!")
|
"reftype"] + ", developer needs to add support for this!")
|
||||||
spot.sig = ref_info["reftype"]
|
spot.sig = ref_info["reftype"]
|
||||||
spot.icon = "person-hiking"
|
spot.icon = get_icon_for_sig(spot.sig)
|
||||||
|
|
||||||
# Add to our list. Don't worry about de-duping, removing old spots etc. at this point; other code will do
|
# Add to our list. Don't worry about de-duping, removing old spots etc. at this point; other code will do
|
||||||
# that for us.
|
# that for us.
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import pytz
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
from core.constants import HTTP_HEADERS
|
from core.constants import HTTP_HEADERS
|
||||||
|
from core.sig_utils import get_icon_for_sig
|
||||||
from data.spot import Spot
|
from data.spot import Spot
|
||||||
from spotproviders.http_spot_provider import HTTPSpotProvider
|
from spotproviders.http_spot_provider import HTTPSpotProvider
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@ class HEMA(HTTPSpotProvider):
|
|||||||
sig="HEMA",
|
sig="HEMA",
|
||||||
sig_refs=[spot_items[3].upper()],
|
sig_refs=[spot_items[3].upper()],
|
||||||
sig_refs_names=[spot_items[4]],
|
sig_refs_names=[spot_items[4]],
|
||||||
icon="mound",
|
icon=get_icon_for_sig("HEMA"),
|
||||||
time=datetime.strptime(spot_items[0], "%d/%m/%Y %H:%M").replace(tzinfo=pytz.UTC).timestamp(),
|
time=datetime.strptime(spot_items[0], "%d/%m/%Y %H:%M").replace(tzinfo=pytz.UTC).timestamp(),
|
||||||
dx_latitude=float(spot_items[7]),
|
dx_latitude=float(spot_items[7]),
|
||||||
dx_longitude=float(spot_items[8]))
|
dx_longitude=float(spot_items[8]))
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
import csv
|
import csv
|
||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
from requests_cache import CachedSession
|
from requests_cache import CachedSession
|
||||||
|
|
||||||
from core.constants import HTTP_HEADERS
|
from core.constants import HTTP_HEADERS
|
||||||
|
from core.sig_utils import get_icon_for_sig
|
||||||
from data.spot import Spot
|
from data.spot import Spot
|
||||||
from spotproviders.http_spot_provider import HTTPSpotProvider
|
from spotproviders.http_spot_provider import HTTPSpotProvider
|
||||||
|
|
||||||
@@ -32,7 +34,7 @@ class ParksNPeaks(HTTPSpotProvider):
|
|||||||
spot = Spot(source=self.name,
|
spot = Spot(source=self.name,
|
||||||
source_id=source_spot["actID"],
|
source_id=source_spot["actID"],
|
||||||
dx_call=source_spot["actCallsign"].upper(),
|
dx_call=source_spot["actCallsign"].upper(),
|
||||||
de_call=source_spot["actSpoter"].upper(), # typo exists in API
|
de_call=source_spot["actSpoter"].upper() if source_spot["actSpoter"] != "" else None, # typo exists in API
|
||||||
freq=float(source_spot["actFreq"].replace(",", "")) * 1000000 if (
|
freq=float(source_spot["actFreq"].replace(",", "")) * 1000000 if (
|
||||||
source_spot["actFreq"] != "") else None,
|
source_spot["actFreq"] != "") else None,
|
||||||
# Seen PNP spots with empty frequency, and with comma-separated thousands digits
|
# Seen PNP spots with empty frequency, and with comma-separated thousands digits
|
||||||
@@ -40,6 +42,7 @@ class ParksNPeaks(HTTPSpotProvider):
|
|||||||
comment=source_spot["actComments"],
|
comment=source_spot["actComments"],
|
||||||
sig=source_spot["actClass"],
|
sig=source_spot["actClass"],
|
||||||
sig_refs=[source_spot["actSiteID"]],
|
sig_refs=[source_spot["actSiteID"]],
|
||||||
|
icon=get_icon_for_sig(source_spot["actClass"]),
|
||||||
time=datetime.strptime(source_spot["actTime"], "%Y-%m-%d %H:%M:%S").replace(
|
time=datetime.strptime(source_spot["actTime"], "%Y-%m-%d %H:%M:%S").replace(
|
||||||
tzinfo=pytz.UTC).timestamp())
|
tzinfo=pytz.UTC).timestamp())
|
||||||
|
|
||||||
@@ -47,21 +50,14 @@ class ParksNPeaks(HTTPSpotProvider):
|
|||||||
if "actLocation" in source_spot and source_spot["actLocation"] != "":
|
if "actLocation" in source_spot and source_spot["actLocation"] != "":
|
||||||
spot.sig_refs_names = [source_spot["actLocation"]]
|
spot.sig_refs_names = [source_spot["actLocation"]]
|
||||||
|
|
||||||
# PNP supports a bunch of programs which should have different icons
|
# Extract a de_call if it's in the comment but not in the "actSpoter" field
|
||||||
if spot.sig == "SiOTA":
|
m = re.search(r"\(de ([A-Za-z0-9]*)\)", spot.comment)
|
||||||
spot.icon = "wheat-awn"
|
if (not spot.de_call or spot.de_call == "ZLOTA") and m:
|
||||||
elif spot.sig == "ZLOTA":
|
spot.de_call = m.group(1)
|
||||||
spot.icon = "kiwi-bird"
|
|
||||||
elif spot.sig == "KRMNPA":
|
# Log a warning for the developer if PnP gives us an unknown programme we've never seen before
|
||||||
spot.icon = "earth-oceania"
|
if spot.sig not in ["POTA", "SOTA", "WWFF", "SiOTA", "ZLOTA", "KRMNPA"]:
|
||||||
elif spot.sig in ["POTA", "SOTA", "WWFF"]:
|
logging.warn("PNP spot found with sig " + spot.sig + ", developer needs to add support for this!")
|
||||||
# Don't care about an icon as this will be rejected anyway, we have better data from POTA/SOTA/WWFF direct
|
|
||||||
spot.icon = ""
|
|
||||||
else:
|
|
||||||
# Unknown programme we've never seen before
|
|
||||||
logging.warn(
|
|
||||||
"PNP spot found with sig " + spot.sig + ", developer needs to add support for icon and grid/lat/lon lookup!")
|
|
||||||
spot.icon = "question"
|
|
||||||
|
|
||||||
# SiOTA lat/lon/grid lookup
|
# SiOTA lat/lon/grid lookup
|
||||||
if spot.sig == "SiOTA":
|
if spot.sig == "SiOTA":
|
||||||
@@ -82,8 +78,6 @@ class ParksNPeaks(HTTPSpotProvider):
|
|||||||
spot.sig_refs_names = [asset["name"]]
|
spot.sig_refs_names = [asset["name"]]
|
||||||
spot.dx_latitude = asset["y"]
|
spot.dx_latitude = asset["y"]
|
||||||
spot.dx_longitude = asset["x"]
|
spot.dx_longitude = asset["x"]
|
||||||
# Junk the "DE call", PNP always returns "ZLOTA" as the spotter for ZLOTA spots
|
|
||||||
spot.de_call = None
|
|
||||||
break
|
break
|
||||||
|
|
||||||
# Note there is currently no support for KRMNPA location lookup, see issue #61.
|
# Note there is currently no support for KRMNPA location lookup, see issue #61.
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
from datetime import datetime
|
import re
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
|
from requests_cache import CachedSession
|
||||||
|
|
||||||
|
from core.constants import HTTP_HEADERS
|
||||||
|
from core.sig_utils import get_icon_for_sig, get_ref_regex_for_sig
|
||||||
from data.spot import Spot
|
from data.spot import Spot
|
||||||
from spotproviders.http_spot_provider import HTTPSpotProvider
|
from spotproviders.http_spot_provider import HTTPSpotProvider
|
||||||
|
|
||||||
@@ -10,6 +14,11 @@ from spotproviders.http_spot_provider import HTTPSpotProvider
|
|||||||
class POTA(HTTPSpotProvider):
|
class POTA(HTTPSpotProvider):
|
||||||
POLL_INTERVAL_SEC = 120
|
POLL_INTERVAL_SEC = 120
|
||||||
SPOTS_URL = "https://api.pota.app/spot/activator"
|
SPOTS_URL = "https://api.pota.app/spot/activator"
|
||||||
|
# Might need to look up extra park data
|
||||||
|
PARK_URL_ROOT = "https://api.pota.app/park/"
|
||||||
|
PARK_DATA_CACHE_TIME_DAYS = 30
|
||||||
|
PARK_DATA_CACHE = CachedSession("cache/pota_park_data_cache",
|
||||||
|
expire_after=timedelta(days=PARK_DATA_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)
|
||||||
@@ -30,13 +39,27 @@ class POTA(HTTPSpotProvider):
|
|||||||
sig_refs=[source_spot["reference"]],
|
sig_refs=[source_spot["reference"]],
|
||||||
sig_refs_names=[source_spot["name"]],
|
sig_refs_names=[source_spot["name"]],
|
||||||
sig_refs_urls=["https://pota.app/#/park/" + source_spot["reference"]],
|
sig_refs_urls=["https://pota.app/#/park/" + source_spot["reference"]],
|
||||||
icon="tree",
|
icon=get_icon_for_sig("POTA"),
|
||||||
time=datetime.strptime(source_spot["spotTime"], "%Y-%m-%dT%H:%M:%S").replace(tzinfo=pytz.UTC).timestamp(),
|
time=datetime.strptime(source_spot["spotTime"], "%Y-%m-%dT%H:%M:%S").replace(
|
||||||
|
tzinfo=pytz.UTC).timestamp(),
|
||||||
dx_grid=source_spot["grid6"],
|
dx_grid=source_spot["grid6"],
|
||||||
dx_latitude=source_spot["latitude"],
|
dx_latitude=source_spot["latitude"],
|
||||||
dx_longitude=source_spot["longitude"])
|
dx_longitude=source_spot["longitude"])
|
||||||
|
|
||||||
|
# Sometimes we can get other refs in the comments for n-fer activations, extract them
|
||||||
|
all_comment_refs = re.findall(get_ref_regex_for_sig("POTA"), spot.comment)
|
||||||
|
for r in all_comment_refs:
|
||||||
|
if r not in spot.sig_refs:
|
||||||
|
spot.sig_refs.append(r.upper())
|
||||||
|
spot.sig_refs_urls.append("https://pota.app/#/park/" + r.upper())
|
||||||
|
|
||||||
|
# Now we need to look up the name of that reference from the API, because the comment won't have it
|
||||||
|
park_response = self.PARK_DATA_CACHE.get(self.PARK_URL_ROOT + r.upper(), headers=HTTP_HEADERS)
|
||||||
|
park_data = park_response.json()
|
||||||
|
if park_data and "name" in park_data:
|
||||||
|
spot.sig_refs_names.append(park_data["name"])
|
||||||
|
|
||||||
# Add to our list. Don't worry about de-duping, removing old spots etc. at this point; other code will do
|
# Add to our list. Don't worry about de-duping, removing old spots etc. at this point; other code will do
|
||||||
# that for us.
|
# that for us.
|
||||||
new_spots.append(spot)
|
new_spots.append(spot)
|
||||||
return new_spots
|
return new_spots
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import requests
|
|||||||
from requests_cache import CachedSession
|
from requests_cache import CachedSession
|
||||||
|
|
||||||
from core.constants import HTTP_HEADERS
|
from core.constants import HTTP_HEADERS
|
||||||
|
from core.sig_utils import get_icon_for_sig
|
||||||
from data.spot import Spot
|
from data.spot import Spot
|
||||||
from spotproviders.http_spot_provider import HTTPSpotProvider
|
from spotproviders.http_spot_provider import HTTPSpotProvider
|
||||||
|
|
||||||
@@ -51,7 +52,7 @@ class SOTA(HTTPSpotProvider):
|
|||||||
sig_refs=[source_spot["summitCode"]],
|
sig_refs=[source_spot["summitCode"]],
|
||||||
sig_refs_names=[source_spot["summitName"]],
|
sig_refs_names=[source_spot["summitName"]],
|
||||||
sig_refs_urls=["https://www.sotadata.org.uk/en/summit/" + source_spot["summitCode"]],
|
sig_refs_urls=["https://www.sotadata.org.uk/en/summit/" + source_spot["summitCode"]],
|
||||||
icon="mountain-sun",
|
icon=get_icon_for_sig("SOTA"),
|
||||||
time=datetime.fromisoformat(source_spot["timeStamp"]).timestamp(),
|
time=datetime.fromisoformat(source_spot["timeStamp"]).timestamp(),
|
||||||
activation_score=source_spot["points"])
|
activation_score=source_spot["points"])
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import json
|
import json
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
from core.sig_utils import get_icon_for_sig
|
||||||
from data.spot import Spot
|
from data.spot import Spot
|
||||||
from spotproviders.sse_spot_provider import SSESpotProvider
|
from spotproviders.sse_spot_provider import SSESpotProvider
|
||||||
|
|
||||||
@@ -38,7 +39,7 @@ class WWBOTA(SSESpotProvider):
|
|||||||
sig="WWBOTA",
|
sig="WWBOTA",
|
||||||
sig_refs=refs,
|
sig_refs=refs,
|
||||||
sig_refs_names=ref_names,
|
sig_refs_names=ref_names,
|
||||||
icon="radiation",
|
icon=get_icon_for_sig("WWBOTA"),
|
||||||
time=datetime.fromisoformat(source_spot["time"]).timestamp(),
|
time=datetime.fromisoformat(source_spot["time"]).timestamp(),
|
||||||
# WWBOTA spots can contain multiple references for bunkers being activated simultaneously. For
|
# WWBOTA spots can contain multiple references for bunkers being activated simultaneously. For
|
||||||
# now, we will just pick the first one to use as our grid, latitude and longitude.
|
# now, we will just pick the first one to use as our grid, latitude and longitude.
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ from datetime import datetime
|
|||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
|
from core.sig_utils import get_icon_for_sig
|
||||||
from data.spot import Spot
|
from data.spot import Spot
|
||||||
from spotproviders.http_spot_provider import HTTPSpotProvider
|
from spotproviders.http_spot_provider import HTTPSpotProvider
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ class WWFF(HTTPSpotProvider):
|
|||||||
sig_refs=[source_spot["reference"]],
|
sig_refs=[source_spot["reference"]],
|
||||||
sig_refs_names=[source_spot["reference_name"]],
|
sig_refs_names=[source_spot["reference_name"]],
|
||||||
sig_refs_urls=["https://wwff.co/directory/?showRef=" + source_spot["reference"]],
|
sig_refs_urls=["https://wwff.co/directory/?showRef=" + source_spot["reference"]],
|
||||||
icon="seedling",
|
icon=get_icon_for_sig("WWFF"),
|
||||||
time=datetime.fromtimestamp(source_spot["spot_time"], tz=pytz.UTC).timestamp(),
|
time=datetime.fromtimestamp(source_spot["spot_time"], tz=pytz.UTC).timestamp(),
|
||||||
dx_latitude=source_spot["latitude"],
|
dx_latitude=source_spot["latitude"],
|
||||||
dx_longitude=source_spot["longitude"])
|
dx_longitude=source_spot["longitude"])
|
||||||
|
|||||||
@@ -413,8 +413,7 @@ paths:
|
|||||||
type: array
|
type: array
|
||||||
description: An array of all the supported Special Interest Groups.
|
description: An array of all the supported Special Interest Groups.
|
||||||
items:
|
items:
|
||||||
type: string
|
$ref: '#/components/schemas/SIG'
|
||||||
example: "POTA"
|
|
||||||
sources:
|
sources:
|
||||||
type: array
|
type: array
|
||||||
description: An array of all the supported data sources.
|
description: An array of all the supported data sources.
|
||||||
@@ -552,13 +551,14 @@ components:
|
|||||||
description: Where we got the DX location (grid/latitude/longitude) from. If this was from the spot itself, it's likely quite accurate, but if we had to fall back to QRZ lookup, or even a location based on the DXCC itself, it will be a lot less accurate.
|
description: Where we got the DX location (grid/latitude/longitude) from. If this was from the spot itself, it's likely quite accurate, but if we had to fall back to QRZ lookup, or even a location based on the DXCC itself, it will be a lot less accurate.
|
||||||
enum:
|
enum:
|
||||||
- SPOT
|
- SPOT
|
||||||
|
- "WAB/WAI GRID"
|
||||||
- QRZ
|
- QRZ
|
||||||
- DXCC
|
- DXCC
|
||||||
- NONE
|
- NONE
|
||||||
example: SPOT
|
example: SPOT
|
||||||
dx_location_good:
|
dx_location_good:
|
||||||
type: boolean
|
type: boolean
|
||||||
description: Does the software think the location is good enough to put a marker on a map? This is true if the source is "SPOT", or alternatively if the source is "QRZ" and the callsign doesn't have a slash in it (i.e. operator likely at home).
|
description: Does the software think the location is good enough to put a marker on a map? This is true if the source is "SPOT" or "WAB/WAI GRID", or alternatively if the source is "QRZ" and the callsign doesn't have a slash in it (i.e. operator likely at home).
|
||||||
example: true
|
example: true
|
||||||
de_call:
|
de_call:
|
||||||
type: string
|
type: string
|
||||||
@@ -975,4 +975,24 @@ components:
|
|||||||
contrast_color:
|
contrast_color:
|
||||||
type: string
|
type: string
|
||||||
description: Black or white, whichever provides the best contrast against the band colour.
|
description: Black or white, whichever provides the best contrast against the band colour.
|
||||||
example: white
|
example: white
|
||||||
|
|
||||||
|
SIG:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
description: The abbreviated name of the SIG
|
||||||
|
example: POTA
|
||||||
|
description:
|
||||||
|
type: string
|
||||||
|
description: The full name of the SIG
|
||||||
|
example: Parks on the Air
|
||||||
|
icon:
|
||||||
|
type: string
|
||||||
|
description: Icon, from the Font Awesome set. This is fairly opinionated but is here to help the Spothole web UI and Field Spotter. Does not include the "fa-" prefix.
|
||||||
|
example: tree
|
||||||
|
ref_regex:
|
||||||
|
type: string
|
||||||
|
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+"
|
||||||
@@ -148,22 +148,16 @@ function updateTable() {
|
|||||||
|
|
||||||
// Format sig_refs
|
// Format sig_refs
|
||||||
var sig_refs = "";
|
var sig_refs = "";
|
||||||
if (s["sig_refs"] && s["sig_refs_urls"] && s["sig_refs"].length == s["sig_refs_urls"].length) {
|
if (s["sig_refs"] && s["sig_refs_urls"] && s["sig_refs"].length == s["sig_refs_urls"].length && s["sig_refs"].length == s["sig_refs_names"].length) {
|
||||||
items = s["sig_refs"].map(s => `<span class='nowrap'>${s}</span>`)
|
items = s["sig_refs"].map(s => `<span class='nowrap'>${s}</span>`)
|
||||||
for (var i = 0; i < items.length; i++) {
|
for (var i = 0; i < items.length; i++) {
|
||||||
items[i] = `<a href='${s["sig_refs_urls"][i]}' target='_new' class='sig-ref-link'>${items[i]}</a>`
|
items[i] = `<a href='${s["sig_refs_urls"][i]}' title='${s["sig_refs_names"][i]}' target='_new' class='sig-ref-link'>${items[i]}</a>`
|
||||||
}
|
}
|
||||||
sig_refs = items.join(", ");
|
sig_refs = items.join(", ");
|
||||||
} else if (s["sig_refs"]) {
|
} else if (s["sig_refs"]) {
|
||||||
sig_refs = s["sig_refs"].map(s => `<span class='nowrap'>${s}</span>`).join(", ");
|
sig_refs = s["sig_refs"].map(s => `<span class='nowrap'>${s}</span>`).join(", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format sig_refs title
|
|
||||||
var sig_refs_title_string = "";
|
|
||||||
if (s["sig_refs_names"]) {
|
|
||||||
sig_refs_title_string = " title=\"" + s["sig_refs_names"].join(", ") + "\"";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Format DE flag
|
// Format DE flag
|
||||||
var de_flag = "<i class='fa-solid fa-circle-question'></i>";
|
var de_flag = "<i class='fa-solid fa-circle-question'></i>";
|
||||||
if (s["de_flag"] && s["de_flag"] != null && s["de_flag"] != "") {
|
if (s["de_flag"] && s["de_flag"] != null && s["de_flag"] != "") {
|
||||||
@@ -209,7 +203,7 @@ function updateTable() {
|
|||||||
$tr.append(`<td class='nowrap hideonmobile'><span class='icon-wrapper'><i class='fa-solid fa-${s["icon"]}'></i></span> ${typeText}</td>`);
|
$tr.append(`<td class='nowrap hideonmobile'><span class='icon-wrapper'><i class='fa-solid fa-${s["icon"]}'></i></span> ${typeText}</td>`);
|
||||||
}
|
}
|
||||||
if (showRef) {
|
if (showRef) {
|
||||||
$tr.append(`<td class='hideonmobile'><span ${sig_refs_title_string}>${sig_refs}</span></td>`);
|
$tr.append(`<td class='hideonmobile'>${sig_refs}</td>`);
|
||||||
}
|
}
|
||||||
if (showDE) {
|
if (showDE) {
|
||||||
$tr.append(`<td class='nowrap hideonmobile'><span class='flag-wrapper' title='${de_country}'>${de_flag}</span>${de_call}</td>`);
|
$tr.append(`<td class='nowrap hideonmobile'><span class='flag-wrapper' title='${de_country}'>${de_flag}</span>${de_call}</td>`);
|
||||||
|
|||||||
Reference in New Issue
Block a user