Compare commits

..
Author SHA1 Message Date
Ian Renton 0ce3ca8d29 First attempt at converting "sig" to "activity" for v3 2026-09-24 07:14:43 +01:00
Ian Renton d91fa70655 First attempt at converting "sig" to "activity" for v3 2026-09-24 07:09:37 +01:00
Ian Renton 1d0129f7bb Merge remote-tracking branch 'origin/main' 2026-09-24 06:38:58 +01:00
Ian Renton 02d08c17cd Release 2.2 2026-09-24 06:38:39 +01:00
Ian Renton e88295cf4b Release 2.2 2026-09-24 06:37:58 +01:00
ian bb9ad4e1f2 Alert DX calls should be allowed to wrap 2026-09-23 21:30:37 +00:00
Ian Renton 9a0a3b938c Fix satellite grid display 2026-09-23 22:13:45 +01:00
Ian Renton c26482f06b Improve the way hamsat alerts work, and add the ability to detect satellite names from spot comments. Closes #149 2026-09-23 22:08:36 +01:00
Ian Renton 981fea57ed Rationalise docs part 5 #151 2026-09-23 21:42:22 +01:00
Ian Renton 5db79ec85a Rationalise docs part 4 #151 2026-09-23 18:25:05 +01:00
Ian Renton 2d14342089 Rationalise docs part 3 #151 2026-09-23 17:50:04 +01:00
Ian Renton c9d0a7652c Rationalise docs part 2 #151 2026-09-23 17:42:06 +01:00
Ian Renton b45a6d8b78 Rationalise docs part 1 #151 2026-09-23 17:31:44 +01:00
Ian Renton 31c7c2095e Improve some error handling. Closes #150 2026-09-23 17:30:12 +01:00
ian 5bdd79c247 Update docs/clients.md 2026-09-23 14:54:07 +00:00
ian ae6733e853 Update docs/clients.md 2026-09-23 14:53:45 +00:00
Ian Renton f8343dd036 Extract some common code into telnet_spot_provier as a base class for DX cluster and RBN 2026-09-22 18:35:05 +01:00
Ian Renton 9067f545af Telnet clients disconnecting shouldn't log an exception 2026-09-20 20:51:01 +01:00
Ian Renton 6037e742cc Fix mojibake in DX cluster and RBN spot comments where the source uses UTF-8 2026-09-20 19:11:53 +01:00
Ian Renton 9272766ffb Fix order in which grids are parsed out of comments 2026-09-20 19:01:48 +01:00
Ian Renton 6f96e0ede1 Improve some activity detection 2026-09-20 10:32:53 +01:00
Ian Renton 190c9f6cef Improve handling of GMA SOTA spots, SOTA references in comments, and grids in comments on VHF 2026-09-20 10:25:08 +01:00
Ian Renton d33259d619 Fix a bug in PNP spot handling where an exception would be thrown if an activity had a location name but not a reference ID. 2026-09-20 10:10:39 +01:00
129 changed files with 2193 additions and 1622 deletions
+7 -24
View File
@@ -1,4 +1,4 @@
# ![Spothole](/static/img/logo.png)
# ![Spothole](https://git.ianrenton.com/ian/spothole/raw/branch/main/static/img/logo.png)
Spothole is a utility to aggregate "spots" from amateur radio DX clusters and xOTA spotting sites, and provide an open
JSON API as well as a website to browse the data, and its own telnet server for integration with desktop loggers.
@@ -17,42 +17,25 @@ individual data source presents its data.
Spothole itself is also open source, Public Domain licenced code that anyone can take and modify.
Supported data sources include DX Clusters, the Reverse Beacon Network (RBN), the APRS Internet Service (APRS-IS), POTA,
SOTA, WWFF, GMA, WWBOTA, HEMA, Parks 'n' Peaks, ZLOTA, WOTA, BOTA, LLOTA, WWTOTA, Tiles on the Air, the UK Packet
Repeater Network, NG3K, and any site based on the xOTA software by nischu. It also integrates with QRZ.com and HamQTH,
retrieves solar data from various sources, provides information about upcoming contests, and more.
You can read more about Spothole on [the "About" page of the main server instance](https://spothole.app/about).
You can read more about Spothole on [the "Help" pages of the main server instance](https://spothole.app/help).
![Screenshot](/images/screenshot2.png)
![Screenshot](/images/screenshot3.png)
## Accessing the public version
You can access the public version's web interface at [https://spothole.app](https://spothole.app), and
see [https://spothole.app/apidocs](https://spothole.app/apidocs) for the API details.
This is a Progressive Web App, so you can also "install" it to your Android or iOS device by accessing it in Chrome or
Safari respectively, and following the menu-driven process for installing PWAs.
You are more than welcome to use the data and the API that Spothole provides to power your own software, to run your own
Spothole server, or to modify it in any way. More details can be found in the following sections:
Spothole server, or to modify it in any way. More details can be found
in [the "Help" pages of the main server instance](https://spothole.app/help).
* [Embedding Spothole in another website](docs/embedding.md)
* [Writing your own client](docs/clients.md)
* [Running your own copy](docs/running.md)
* [nginx reverse proxy configuration](docs/nginx.md)
* [systemd service file](docs/systemd.md)
* [Running in Docker](docs/docker.md)
* [Use of multiple cluster logins](docs/multicluster.md)
* [Modifying the source code](docs/modifying.md)
![Screenshot](/images/screenshot4.png)
![Screenshot](/images/screenshot3.png)
## Thanks
[Spothole's "About" page](https://spothole.app/about) contains the full details of the thanks I owe to the various
[Spothole's "Thanks" page](https://spothole.app/help/thanks) contains the full details of the thanks I owe to the
various
programme teams, software library providers, bug fixers etc. The extra detail below contains the extra detail of
specific files in this repository which are not all my own work and may be subject to other licences.
+7 -7
View File
@@ -130,25 +130,25 @@ spot_providers:
url: "wss://39c3.totawatch.de/api/spot/live"
# For the "XOTA" provider, an activity must be set manually here because xOTA is a generic backend for xOTA
# programmes and so different URLs potentially provide different programmes.
sig: "Toilets"
activity: "Toilets"
# For Toilets on the Air, we prefix the activity references (T-01 etc) with some characters that define the
# conference: C3, EH or HOPE - so we can look up the correct locations in our database, because each conference
# starts from T-01 but refers to a toilet in a different building (or continent!)
sig_ref_prefix: "C3"
activity_ref_prefix: "C3"
- class: "XOTA"
name: "EH23 TOTA"
enabled: false
url: "wss://eh23.totawatch.de/api/spot/live"
sig: "Toilets"
sig_ref_prefix: "EH"
activity: "Toilets"
activity_ref_prefix: "EH"
- class: "XOTA"
name: "HOPE26 TOTA"
enabled: false
url: "wss://hope-26.totawatch.de/api/spot/live"
sig: "Toilets"
sig_ref_prefix: "HOPE"
activity: "Toilets"
activity_ref_prefix: "HOPE"
# Alert providers to use. Same setup as the spot providers list above.
@@ -218,7 +218,7 @@ static_data_providers:
# Activity reference data providers to use. These allow Spothole to download, for example, the WWFF directory that
# maps WWFF park IDs to their name and location.
sig_ref_data_providers:
activity_ref_data_providers:
- class: "POTA"
enabled: true
+6 -6
View File
@@ -27,7 +27,7 @@ def get_activity_ref_info(activity_name, ref_id):
ref_id = ref_id.replace(" ", "-")
# Prepare the object to be returned
activity_ref = ActivityRef(sig=activity_name, id=ref_id)
activity_ref = ActivityRef(activity=activity_name, id=ref_id)
# We can always get the reference type and the icon from the activity itself
activity = get_activity_by_name(activity_name)
@@ -52,11 +52,11 @@ def get_activity_ref_info(activity_name, ref_id):
if activity_name.upper() == ActivityName.DTMBA:
ref_id = ref_id.replace("-", "").replace(" ", "")
### NO DATA ACTIVITIES ###
### NO REFERENCE ACTIVITIES ###
#
# If the activity is HEMA or BIWOTA, we have no way to either generate useful data or look it up on a
# If the activity doesn't have references, we have no way to either generate useful data or look it up on a
# reference list, so just skip the lookup here.
if activity_name.upper() == ActivityName.HEMA or activity_name.upper() == ActivityName.BIWOTA:
if not activity.has_refs:
return activity_ref
### PROGRAMMATIC DATA GENERATION INSTEAD OF LOOKUPS ###
@@ -141,11 +141,11 @@ def get_activity_ref_info(activity_name, ref_id):
def populate_missing_activity_ref_info(activity_ref):
"""Look up details of an activity reference (e.g. POTA park) such as name, lat/lon, and grid. Takes in an
activity_ref object which must at minimum have a "sig" and an "id". The rest of the object will be populated
activity_ref object which must at minimum have an "activity" and an "id". The rest of the object will be populated
and returned. Any data currently in the object will be kept, only missing data in the object will be populated
if it can be determined."""
lookup_data = get_activity_ref_info(activity_ref.sig, activity_ref.id)
lookup_data = get_activity_ref_info(activity_ref.activity, activity_ref.id)
if lookup_data:
# Copy new activity ref data into existing object where data was previously missing
+1 -1
View File
@@ -2,7 +2,7 @@ from core.config import SERVER_OWNER_CALLSIGN
from data.band import Band
# General software
SOFTWARE_VERSION = "2.2-pre"
SOFTWARE_VERSION = "3.0-pre"
# HTTP headers used for spot providers that use HTTP
HTTP_HEADERS = {"User-Agent": f"Spothole v{SOFTWARE_VERSION} (operated by {SERVER_OWNER_CALLSIGN})"}
+5 -5
View File
@@ -15,7 +15,7 @@ class DataProviders:
self.alert_providers = []
self.solar_condition_providers = []
self.static_data_providers = []
self.sig_ref_data_providers = []
self.activity_ref_data_providers = []
self.callsign_data_providers = []
self._startup_timers = []
@@ -28,8 +28,8 @@ class DataProviders:
self.solar_condition_providers.append(create_provider_from_config("providers.solarconditions", entry))
for entry in config.get("static_data_providers", []):
self.static_data_providers.append(create_provider_from_config("providers.staticdata", entry))
for entry in config.get("sig_ref_data_providers", []):
self.sig_ref_data_providers.append(create_provider_from_config("providers.activityrefdata", entry))
for entry in config.get("activity_ref_data_providers", []):
self.activity_ref_data_providers.append(create_provider_from_config("providers.activityrefdata", entry))
for entry in config.get("callsign_data_providers", []):
self.callsign_data_providers.append(create_provider_from_config("providers.callsigndata", entry))
@@ -54,7 +54,7 @@ class DataProviders:
25.0,
lambda: self.start_providers(self.solar_condition_providers, "solar condition"),
),
threading.Timer(30.0, lambda: self.start_providers(self.sig_ref_data_providers, "activity ref data")),
threading.Timer(30.0, lambda: self.start_providers(self.activity_ref_data_providers, "activity ref data")),
]
for t in self._startup_timers:
t.daemon = True
@@ -72,7 +72,7 @@ class DataProviders:
self.spot_providers
+ self.alert_providers
+ self.solar_condition_providers
+ self.sig_ref_data_providers
+ self.activity_ref_data_providers
+ self.static_data_providers
+ self.callsign_data_providers
)
+2 -1
View File
@@ -77,7 +77,7 @@ class LocationSourceForSpot(str, Enum):
"""Where the location data came from in a spot."""
SPOT = "SPOT"
SIG_REF_LOOKUP = "SIG REF LOOKUP"
ACTIVITY_REF_LOOKUP = "ACTIVITY REF LOOKUP"
GRID = "GRID"
HOME_QTH = "HOME QTH"
DXCC = "DXCC"
@@ -163,6 +163,7 @@ class ActivityRefType(str, Enum):
BUILDING = "BUILDING"
REGION = "REGION"
GRID = "GRID"
SATELLITE = "SATELLITE"
TOILET = "TOILET"
+3 -3
View File
@@ -111,9 +111,9 @@ class StatusReporter:
}
for p in DATA_PROVIDERS.static_data_providers
]
DATA_STORE.status.get()["sig_ref_data_providers"] = [
DATA_STORE.status.get()["activity_ref_data_providers"] = [
{
"sig_name": p.sig_name,
"activity_name": p.activity_name,
"enabled": p.enabled,
"status": p.status,
"last_updated": p.last_update_time.replace(tzinfo=pytz.UTC).timestamp()
@@ -121,7 +121,7 @@ class StatusReporter:
else 0,
"reference_count": p.reference_count,
}
for p in DATA_PROVIDERS.sig_ref_data_providers
for p in DATA_PROVIDERS.activity_ref_data_providers
]
DATA_STORE.status.get()["callsign_data_providers"] = [
{
+10
View File
@@ -156,3 +156,13 @@ def get_callsign_object_from_pyhamtools_callinfo(callsign, callinfo):
except (KeyError, ValueError):
# Unknown callsign, can't look anything up, return a Callsign object with basic data so that gets cached
return Callsign(call=callsign)
def decode_telnet_bytes(data: bytes) -> str:
"""Decode a line of text received from a telnet connection, which might be UTF-8 or Latin-1 depending on the
whims of the server owner."""
try:
return data.decode("utf-8")
except UnicodeDecodeError:
return data.decode("latin-1")
+56 -54
View File
@@ -5,33 +5,35 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.CONTEST: Activity(
name=ActivityName.CONTEST,
description="Contest",
sig_type=ActivityType.TRADITIONAL,
activity_type=ActivityType.TRADITIONAL,
has_refs=False,
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,
),
ActivityName.DXPEDITION: Activity(
name=ActivityName.DXPEDITION,
description="Radio expedition to a remote location",
sig_type=ActivityType.TRADITIONAL,
activity_type=ActivityType.TRADITIONAL,
has_refs=False,
refs_globally_unique=False,
# DXpedition stations are never really spotted with "DXpedition" in the comments, but we can assign
# this activity to a spot other ways.
comment_names=[],
comment_names=["DXPEDITION"],
icon="fa-book-atlas",
alerts_possible=True,
),
ActivityName.SATELLITE: Activity(
name=ActivityName.SATELLITE,
description="Amateur Radio Satellite",
sig_type=ActivityType.TRADITIONAL,
has_refs=False,
refs_globally_unique=False,
activity_type=ActivityType.TRADITIONAL,
# Satellite "references" are the names of the satellites themselves. This is not an exhaustive list, it just
# matches some of the most commonly used amateur radio satellites so they can be picked out of spot comments.
has_refs=True,
refs_globally_unique=True,
ref_type=ActivityRefType.SATELLITE,
ref_regex=r"ISS|AO-(?:7|27|73|91|95|123)|QO-100|QO100|QO 100|RS-44|SO-50",
comment_names=[],
icon="fa-satellite",
alerts_possible=True,
@@ -39,7 +41,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.EME: Activity(
name=ActivityName.EME,
description="Earth-Moon-Earth (Moonbounce)",
sig_type=ActivityType.TRADITIONAL,
activity_type=ActivityType.TRADITIONAL,
has_refs=False,
refs_globally_unique=False,
comment_names=[],
@@ -48,7 +50,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.AERONAUTICAL_MOBILE: Activity(
name=ActivityName.AERONAUTICAL_MOBILE,
description="Aeronautical Mobile",
sig_type=ActivityType.TRADITIONAL,
activity_type=ActivityType.TRADITIONAL,
has_refs=False,
refs_globally_unique=False,
# Don't pick /AM out of comments, spot.py will handle picking it out of the callsign
@@ -58,7 +60,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.MARITIME_MOBILE: Activity(
name=ActivityName.MARITIME_MOBILE,
description="Maritime Mobile",
sig_type=ActivityType.TRADITIONAL,
activity_type=ActivityType.TRADITIONAL,
has_refs=False,
refs_globally_unique=False,
# Don't pick /MM out of comments, spot.py will handle picking it out of the callsign
@@ -68,7 +70,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.QRP: Activity(
name=ActivityName.QRP,
description="Low power",
sig_type=ActivityType.TRADITIONAL,
activity_type=ActivityType.TRADITIONAL,
has_refs=False,
refs_globally_unique=False,
comment_names=["QRP"],
@@ -78,7 +80,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.POTA: Activity(
name=ActivityName.POTA,
description="Parks on the Air",
sig_type=ActivityType.ADVENTURE,
activity_type=ActivityType.ADVENTURE,
has_refs=True,
refs_globally_unique=False,
ref_type=ActivityRefType.PARK,
@@ -90,9 +92,9 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.SOTA: Activity(
name=ActivityName.SOTA,
description="Summits on the Air",
sig_type=ActivityType.ADVENTURE,
activity_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"],
@@ -102,7 +104,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.WWFF: Activity(
name=ActivityName.WWFF,
description="World Wide Flora & Fauna",
sig_type=ActivityType.ADVENTURE,
activity_type=ActivityType.ADVENTURE,
has_refs=True,
refs_globally_unique=True,
ref_type=ActivityRefType.PARK,
@@ -114,7 +116,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.GMA: Activity(
name=ActivityName.GMA,
description="Global Mountain Activity",
sig_type=ActivityType.ADVENTURE,
activity_type=ActivityType.ADVENTURE,
has_refs=True,
refs_globally_unique=False,
ref_type=ActivityRefType.SUMMIT,
@@ -125,7 +127,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.WWBOTA: Activity(
name=ActivityName.WWBOTA,
description="Worldwide Bunkers on the Air",
sig_type=ActivityType.ADVENTURE,
activity_type=ActivityType.ADVENTURE,
has_refs=True,
refs_globally_unique=True,
ref_type=ActivityRefType.BUNKER,
@@ -136,7 +138,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.HEMA: Activity(
name=ActivityName.HEMA,
description="HuMPs Excluding Marilyns Award",
sig_type=ActivityType.ADVENTURE,
activity_type=ActivityType.ADVENTURE,
has_refs=True,
refs_globally_unique=False,
ref_type=ActivityRefType.SUMMIT,
@@ -148,29 +150,29 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.IOTA: Activity(
name=ActivityName.IOTA,
description="Islands on the Air",
sig_type=ActivityType.ADVENTURE,
activity_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",
),
ActivityName.GMA_ISLANDS: Activity(
name=ActivityName.GMA_ISLANDS,
description="Global Mountain Activity - Islands",
sig_type=ActivityType.ADVENTURE,
activity_type=ActivityType.ADVENTURE,
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",
),
ActivityName.ARLHS: Activity(
name=ActivityName.ARLHS,
description="Amateur Radio Lighthouse Society",
sig_type=ActivityType.ADVENTURE,
activity_type=ActivityType.ADVENTURE,
has_refs=True,
refs_globally_unique=False,
ref_type=ActivityRefType.LIGHTHOUSE,
@@ -181,7 +183,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.ILLW: Activity(
name=ActivityName.ILLW,
description="International Lighthouse & Lightship Weekend",
sig_type=ActivityType.EVENT,
activity_type=ActivityType.EVENT,
has_refs=True,
refs_globally_unique=False,
ref_type=ActivityRefType.LIGHTHOUSE,
@@ -192,7 +194,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.MOTA: Activity(
name=ActivityName.MOTA,
description="Mills on the Air",
sig_type=ActivityType.EVENT,
activity_type=ActivityType.EVENT,
has_refs=True,
refs_globally_unique=True,
ref_type=ActivityRefType.MILL,
@@ -203,7 +205,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.SIOTA: Activity(
name=ActivityName.SIOTA,
description="Silos on the Air",
sig_type=ActivityType.ADVENTURE,
activity_type=ActivityType.ADVENTURE,
has_refs=True,
refs_globally_unique=False,
ref_type=ActivityRefType.SILO,
@@ -215,7 +217,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.WCA: Activity(
name=ActivityName.WCA,
description="World Castles Award",
sig_type=ActivityType.ADVENTURE,
activity_type=ActivityType.ADVENTURE,
has_refs=True,
refs_globally_unique=False,
ref_type=ActivityRefType.CASTLE,
@@ -226,7 +228,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.ZLOTA: Activity(
name=ActivityName.ZLOTA,
description="New Zealand on the Air",
sig_type=ActivityType.REGIONAL,
activity_type=ActivityType.REGIONAL,
has_refs=True,
refs_globally_unique=True,
ref_type=None,
@@ -239,7 +241,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.WOTA: Activity(
name=ActivityName.WOTA,
description="Wainwrights on the Air",
sig_type=ActivityType.REGIONAL,
activity_type=ActivityType.REGIONAL,
has_refs=True,
refs_globally_unique=False,
ref_type=ActivityRefType.SUMMIT,
@@ -252,7 +254,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.BOTA: Activity(
name=ActivityName.BOTA,
description="Beaches on the Air",
sig_type=ActivityType.ADVENTURE,
activity_type=ActivityType.ADVENTURE,
has_refs=True,
refs_globally_unique=False,
ref_type=ActivityRefType.BEACH,
@@ -263,7 +265,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.KRMNPA: Activity(
name=ActivityName.KRMNPA,
description="Keith Roget Memorial National Parks Award",
sig_type=ActivityType.REGIONAL,
activity_type=ActivityType.REGIONAL,
has_refs=True,
refs_globally_unique=False,
ref_type=ActivityRefType.PARK,
@@ -276,7 +278,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.SANPCPA: Activity(
name=ActivityName.SANPCPA,
description="South Australian National Parks and Conservation Parks Award",
sig_type=ActivityType.REGIONAL,
activity_type=ActivityType.REGIONAL,
has_refs=True,
refs_globally_unique=False,
ref_type=ActivityRefType.PARK,
@@ -289,7 +291,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.LLOTA: Activity(
name=ActivityName.LLOTA,
description="Lagos y Lagunas on the Air",
sig_type=ActivityType.ADVENTURE,
activity_type=ActivityType.ADVENTURE,
has_refs=True,
refs_globally_unique=True,
ref_type=ActivityRefType.LAKE,
@@ -301,7 +303,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.TOWERS: Activity(
name=ActivityName.TOWERS,
description="Towers on the Air",
sig_type=ActivityType.ADVENTURE,
activity_type=ActivityType.ADVENTURE,
has_refs=True,
refs_globally_unique=False,
ref_type=ActivityRefType.TOWER,
@@ -312,7 +314,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.TILES: Activity(
name=ActivityName.TILES,
description="Tiles on the Air",
sig_type=ActivityType.ADVENTURE,
activity_type=ActivityType.ADVENTURE,
has_refs=True,
refs_globally_unique=False,
ref_type=ActivityRefType.GRID,
@@ -323,7 +325,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.RADAR_RALLY: Activity(
name=ActivityName.RADAR_RALLY,
description="RaDAR Rally",
sig_type=ActivityType.EVENT,
activity_type=ActivityType.EVENT,
has_refs=False,
refs_globally_unique=False,
comment_names=["RaDAR"],
@@ -332,7 +334,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.WAB: Activity(
name=ActivityName.WAB,
description="Worked All Britain",
sig_type=ActivityType.REGIONAL,
activity_type=ActivityType.REGIONAL,
has_refs=True,
refs_globally_unique=False,
ref_type=ActivityRefType.GRID,
@@ -344,7 +346,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.WAI: Activity(
name=ActivityName.WAI,
description="Worked All Ireland",
sig_type=ActivityType.REGIONAL,
activity_type=ActivityType.REGIONAL,
has_refs=True,
refs_globally_unique=False,
ref_type=ActivityRefType.GRID,
@@ -356,7 +358,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.DMF: Activity(
name=ActivityName.DMF,
description="Diplôme des Moulins de France",
sig_type=ActivityType.REGIONAL,
activity_type=ActivityType.REGIONAL,
has_refs=True,
refs_globally_unique=False,
ref_type=ActivityRefType.MILL,
@@ -367,7 +369,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.DME: Activity(
name=ActivityName.DME,
description="Diploma Municipios de España",
sig_type=ActivityType.REGIONAL,
activity_type=ActivityType.REGIONAL,
has_refs=True,
refs_globally_unique=True,
ref_type=ActivityRefType.TOWN,
@@ -379,14 +381,14 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.FEA: Activity(
name=ActivityName.FEA,
description="Diploma Faros de España",
sig_type=ActivityType.REGIONAL,
activity_type=ActivityType.REGIONAL,
has_refs=True,
refs_globally_unique=True,
ref_type=ActivityRefType.LIGHTHOUSE,
# 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="🇪🇸",
@@ -394,7 +396,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.DMUE: Activity(
name=ActivityName.DMUE,
description="Diploma Museos de España",
sig_type=ActivityType.REGIONAL,
activity_type=ActivityType.REGIONAL,
has_refs=True,
refs_globally_unique=True,
ref_type=ActivityRefType.BUILDING,
@@ -406,7 +408,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.DMVE: Activity(
name=ActivityName.DMVE,
description="Diploma Monumentos y Vestigios de España",
sig_type=ActivityType.REGIONAL,
activity_type=ActivityType.REGIONAL,
has_refs=True,
refs_globally_unique=True,
ref_type=ActivityRefType.BUILDING,
@@ -418,7 +420,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.DCE: Activity(
name=ActivityName.DCE,
description="Diploma Castillos de España",
sig_type=ActivityType.REGIONAL,
activity_type=ActivityType.REGIONAL,
has_refs=True,
refs_globally_unique=False,
ref_type=ActivityRefType.CASTLE,
@@ -430,7 +432,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.DEFE: Activity(
name=ActivityName.DEFE,
description="Diploma Estaciones de Ferrocarril de España",
sig_type=ActivityType.REGIONAL,
activity_type=ActivityType.REGIONAL,
has_refs=True,
refs_globally_unique=True,
ref_type=ActivityRefType.BUILDING,
@@ -442,7 +444,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.DTMBA: Activity(
name=ActivityName.DTMBA,
description="Diploma Teatri Musei e Belle Arti",
sig_type=ActivityType.REGIONAL,
activity_type=ActivityType.REGIONAL,
has_refs=True,
refs_globally_unique=True,
ref_type=ActivityRefType.BUILDING,
@@ -454,7 +456,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.BIWOTA: Activity(
name=ActivityName.BIWOTA,
description="British Inland Waterways on the Air",
sig_type=ActivityType.EVENT,
activity_type=ActivityType.EVENT,
has_refs=False,
refs_globally_unique=False,
ref_type=ActivityRefType.WATERWAY,
@@ -465,7 +467,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.COTA: Activity(
name=ActivityName.COTA,
description="Castles on the Air",
sig_type=ActivityType.REGIONAL,
activity_type=ActivityType.REGIONAL,
has_refs=True,
refs_globally_unique=False,
ref_type=ActivityRefType.CASTLE,
@@ -477,7 +479,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.PGA: Activity(
name=ActivityName.PGA,
description="Polish Gmina Award",
sig_type=ActivityType.REGIONAL,
activity_type=ActivityType.REGIONAL,
has_refs=True,
refs_globally_unique=False,
ref_type=ActivityRefType.REGION,
@@ -489,7 +491,7 @@ ACTIVITIES: dict[ActivityName, Activity] = {
ActivityName.TOILETS: Activity(
name=ActivityName.TOILETS,
description="Toilets on the Air",
sig_type=ActivityType.EVENT,
activity_type=ActivityType.EVENT,
has_refs=True,
refs_globally_unique=True,
ref_type=ActivityRefType.TOILET,
+8 -10
View File
@@ -5,22 +5,20 @@ from core.enums import ActivityName, ActivityRefType, ActivityType
@dataclass
class Activity:
"""Data class that defines an Activity (formerly referred to as a "Special Interest Group" or "SIG", a term
which is still used for the `sig` field name in the API for backwards compatibility). Each contains a name and
a longer form description. They also contain comment_names which attempts to separate out the way people might
refer to it in cluster comments from how it is referred to in the UI & API. (For example, "TOTA" in cluster
spot comments almost always means Towers on the Air, but no single programme is referred to in the UI as "TOTA"
as it's ambiguous between Towers, Toilets and Tiles. And while Beaches got the name "BOTA" first, "BOTA" spots
are much more likely to be bunkers.) Finally, there is a ref_regex which provides a regular expression to
match what references (such as parks and summits) look like for that programme."""
"""Data class that defines an Activity. Each contains a name and a longer form description. They also contain
comment_names which attempts to separate out the way people might refer to it in cluster comments from how it is
referred to in the UI & API. (For example, "TOTA" in cluster spot comments almost always means Towers on the Air,
but no single programme is referred to in the UI as "TOTA" as it's ambiguous between Towers, Toilets and Tiles.
And while Beaches got the name "BOTA" first, "BOTA" spots are much more likely to be bunkers.) Finally, there is a
ref_regex which provides a regular expression to match what references (such as parks and summits) look like for
that programme."""
# Activity name as used in the UI and API, e.g. "Towers"
name: ActivityName
# Description, e.g. "Towers on the Air"
description: str
# Type, either Worldwide, Regional or Event. Used for sorting in the web UI.
# Note: this field is still named "sig_type" in the API for backwards compatibility.
sig_type: ActivityType
activity_type: ActivityType
# Whether this activity has a fixed set of references (e.g. parks) with some sort of ID to "activate"
has_refs: bool
# Identifies that the activity's reference ID structure defined by its regex is unique across all programmes and
+2 -2
View File
@@ -8,8 +8,8 @@ class ActivityRef:
"""Data class that defines an Activity "info" or reference. As well as the basic reference ID we include a
name and a lookup URL."""
# Activity that this reference is in, e.g. "POTA". Still named "sig" for backwards compatibility with the API.
sig: str
# Activity that this reference is in, e.g. "POTA".
activity: str
# Reference ID, e.g. "GB-0001".
id: str | None = None
# Name of the reference, e.g. "Null Country Park", if known.
+43 -16
View File
@@ -5,6 +5,7 @@ from dataclasses import dataclass, field
from datetime import datetime, timedelta
import pytz
from pyhamtools.locator import latlong_to_locator, locator_to_latlong
from core.activity_lookup_helper import populate_missing_activity_ref_info
from core.activity_utils import get_icon_for_activity
@@ -40,6 +41,11 @@ class Alert:
dx_cq_zone: int | None = None
# ITU zone of the DX operator
dx_itu_zone: int | None = None
# Maidenhead grid locator for the DX. This could be from a geographical reference e.g. POTA or grid.
dx_grid: str | None = None
# Latitude & longitude of the DX, in degrees. This could be from a geographical reference e.g. POTA or grid.
dx_latitude: float | None = None
dx_longitude: float | None = None
# General alert info
@@ -60,11 +66,10 @@ class Alert:
# Activity info
# Activity (e.g. outdoor activity programme such as POTA). Still named "sig" for API backwards compatibility.
sig: str | None = None
# Activity references. We allow multiple here for e.g. n-fer activations, unlike ADIF SIG_INFO. Still named
# "sig_refs" for API backwards compatibility.
sig_refs: list = field(default_factory=list)
# Activity (e.g. outdoor activity programme such as POTA).
activity: str | None = None
# Activity references. We allow multiple here for e.g. n-fer activations, unlike ADIF SIG_INFO.
activity_refs: list = field(default_factory=list)
# Timing info
@@ -108,8 +113,7 @@ class Alert:
if self.received_time and not self.received_time_iso:
self.received_time_iso = datetime.fromtimestamp(self.received_time, pytz.UTC).isoformat()
# DX country, continent, zones etc. from callsign. CQ/ITU zone are better looked up with a location but we don't
# have a real location for alerts.
# DX country, continent, zones etc. from callsign.
if self.dx_calls and self.dx_calls[0]:
call_info = get_call_info(self.dx_calls[0], credentials)
if self.dx_calls and self.dx_calls[0] and not self.dx_country:
@@ -125,17 +129,40 @@ class Alert:
if self.dx_dxcc_id and not self.dx_flag:
self.dx_flag = get_flag_for_dxcc(self.dx_dxcc_id)
# Fetch activity data. In case a particular API doesn't provide a full set of name, lat, lon & grid for a
# reference in its initial call, we use this code to populate the rest of the data. This includes working
# out grid refs from WAB and WAI, which count as an activity even though there's no real lookup, just maths
if self.sig_refs:
for activity_ref in self.sig_refs:
populate_missing_activity_ref_info(activity_ref)
# Fetch activity data, and set a real position if we can get one.
if self.activity_refs:
for activity_ref in self.activity_refs:
activity_ref = populate_missing_activity_ref_info(activity_ref)
# If the alert itself doesn't have location yet, but the activity ref does, extract it
if activity_ref.grid and not self.dx_grid:
self.dx_grid = activity_ref.grid
if (
activity_ref.latitude
and not self.dx_latitude
and activity_ref.longitude
and not self.dx_longitude
):
self.dx_latitude = activity_ref.latitude
self.dx_longitude = activity_ref.longitude
# If the spot itself doesn't have an activity yet, but we have at least one activity reference, take that
# reference's activity and apply it to the whole spot.
if self.sig_refs and self.sig_refs[0] and not self.sig:
self.sig = self.sig_refs[0].sig
if self.activity_refs and self.activity_refs[0] and not self.activity:
self.activity = self.activity_refs[0].activity
# 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):
try:
ll = locator_to_latlong(self.dx_grid)
self.dx_latitude = ll[0]
self.dx_longitude = ll[1]
except Exception:
logger.debug("Invalid grid received for spot", exc_info=True)
if self.dx_latitude and self.dx_longitude and not self.dx_grid:
try:
self.dx_grid = latlong_to_locator(self.dx_latitude, self.dx_longitude, 8)
except Exception:
logger.debug("Invalid lat/lon received for spot", exc_info=True)
# Create an ID based on the source and source ID if possible, as these guaranee uniqueness. If there is no
# source ID, use a combination of callsign and start time. Excluding things like the comment here allows for
@@ -154,7 +181,7 @@ class Alert:
# Icon for the alert should be the icon of its activity if known, otherwise a radio tower
self.icon = "fa-tower-cell"
if self.sig and (activity_icon := get_icon_for_activity(self.sig)):
if self.activity and (activity_icon := get_icon_for_activity(self.activity)):
self.icon = activity_icon
except Exception:
+80 -68
View File
@@ -76,8 +76,8 @@ class Spot:
# DX Location source. Indicates how accurate the location might be.
dx_location_source: LocationSourceForSpot | None = None
# 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", "SIG REF LOOKUP" or "GRID", or if the location source is "HOME QTH" and
# the DX callsign doesn't have a suffix like /P. (Location source retains "SIG" wording for API compatibility.)
# true if the location source is "SPOT", "ACTIVITY REF LOOKUP" or "GRID", or if the location source is "HOME QTH"
# and the DX callsign doesn't have a suffix like /P.
dx_location_good: bool = False
# DE (Spotter) info
@@ -125,11 +125,10 @@ class Spot:
# Activity info
# Activity (e.g. outdoor activity programme such as POTA). Still named "sig" for API backwards compatibility.
sig: str | None = None
# Activity references. We allow multiple here for e.g. n-fer activations, unlike ADIF SIG_INFO. Still named
# "sig_refs" for API backwards compatibility.
sig_refs: list = field(default_factory=list)
# Activity (e.g. outdoor activity programme such as POTA).
activity: str | None = None
# Activity references. We allow multiple here for e.g. n-fer activations, unlike ADIF SIG_INFO.
activity_refs: list = field(default_factory=list)
# Timing info
@@ -159,12 +158,12 @@ class Spot:
def __post_init__(self):
"""Normalise fields that don't survive a plain dict to Spot conversion. This is used in the "add spot" API
endpoint where the client is submitting JSON, and we want to recreate a full Spot object, including nested
objects such as the sig_refs list.."""
objects such as the activity_refs list.."""
if self.sig_refs:
self.sig_refs = [
if self.activity_refs:
self.activity_refs = [
activity_ref if isinstance(activity_ref, ActivityRef) else ActivityRef(**activity_ref)
for activity_ref in self.sig_refs
for activity_ref in self.activity_refs
]
def infer_missing(self, credentials=None):
@@ -270,18 +269,20 @@ class Spot:
self.dx_location_source = LocationSourceForSpot.SPOT
# Set the top-level activity if it is missing but we have at least one activity ref.
if not self.sig and self.sig_refs:
self.sig = self.sig_refs[0].sig.upper()
if not self.activity and self.activity_refs:
self.activity = self.activity_refs[0].activity.upper()
# See if we already have an activity reference, but the comment looks like it contains more for the same
# activity. This should catch e.g. POTA comments like "2-fer: GB-0001 GB-0002".
if self.comment and self.sig_refs and self.sig_refs[0].sig:
activity = self.sig_refs[0].sig.upper()
if self.comment and self.activity_refs and self.activity_refs[0].activity:
activity = self.activity_refs[0].activity.upper()
regex = get_ref_regex_for_activity(activity)
if regex:
all_comment_ref_matches = re.finditer(r"(^|\W)(" + regex + r")($|\W)", self.comment, re.IGNORECASE)
for ref_match in all_comment_ref_matches:
self._append_activity_ref_if_missing(ActivityRef(id=ref_match.group(2).upper(), sig=activity))
self._append_activity_ref_if_missing(
ActivityRef(id=ref_match.group(2).upper(), activity=activity)
)
# See if the comment looks like it contains any activities (and optionally activity references) that we
# can add to the spot. This should catch cluster spot comments like "POTA GB-0001 WWFF GFF-0001" and e.g.
@@ -292,11 +293,11 @@ class Spot:
# First of all, if we haven't got an activity for this spot set yet, now we have. This covers
# things like cluster spots where the comment is just "POTA".
found_activity = get_activity_name_from_comment_name(activity_match.group(2))
if not self.sig:
self.sig = found_activity
if not self.activity:
self.activity = found_activity
# Now look to see if that activity name was followed by something that looks like a reference ID
# for that activity. If so, add that to the sig_refs list for this spot.
# for that activity. If so, add that to the activity_refs list for this spot.
found_activity_info = get_activity_by_name(found_activity)
if found_activity_info and found_activity_info.has_refs and found_activity_info.ref_regex:
ref_matches = re.finditer(
@@ -306,7 +307,7 @@ class Spot:
)
for ref_match in ref_matches:
self._append_activity_ref_if_missing(
ActivityRef(id=ref_match.group(3).upper(), sig=found_activity)
ActivityRef(id=ref_match.group(3).upper(), activity=found_activity)
)
# See if the comment looks like it contains any activity references *without* the corresponding activity
@@ -322,17 +323,17 @@ class Spot:
# First of all, if we haven't got an activity for this spot set yet, now we have. This
# covers things like cluster spots where the comment is just "OHFF-1234", now we know
# it's WWFF.
if not self.sig:
self.sig = activity.name
if not self.activity:
self.activity = activity.name
self._append_activity_ref_if_missing(
ActivityRef(id=ref_match.group(2).upper(), sig=activity.name)
ActivityRef(id=ref_match.group(2).upper(), activity=activity.name)
)
# Fetch activity data. In case a particular API doesn't provide a full set of name, lat, lon & grid for a
# reference in its initial call, we use this code to populate the rest of the data. This includes working
# out grid refs from WAB and WAI, which count as an activity even though there's no real lookup, just maths
if self.sig_refs:
for activity_ref in self.sig_refs:
if self.activity_refs:
for activity_ref in self.activity_refs:
activity_ref = populate_missing_activity_ref_info(activity_ref)
# If the spot itself doesn't have location yet, but the activity ref does, extract it
if activity_ref.grid and not self.dx_grid:
@@ -345,34 +346,34 @@ class Spot:
):
self.dx_latitude = activity_ref.latitude
self.dx_longitude = activity_ref.longitude
if self.sig in (ActivityName.WAB, ActivityName.WAI, ActivityName.TILES):
if self.activity in (ActivityName.WAB, ActivityName.WAI, ActivityName.TILES):
self.dx_location_source = LocationSourceForSpot.GRID
else:
self.dx_location_source = LocationSourceForSpot.SIG_REF_LOOKUP
self.dx_location_source = LocationSourceForSpot.ACTIVITY_REF_LOOKUP
# If the spot itself doesn't have an activity yet, but we have at least one activity reference, take that
# reference's activity and apply it to the whole spot.
if self.sig_refs and not self.sig:
self.sig = self.sig_refs[0].sig
if self.activity_refs and not self.activity:
self.activity = self.activity_refs[0].activity
# Parse "de_grid<prop_mode>dx_grid" structures from the comment, e.g. "JN61ES(ES)JM56XT" or "JO02GQ<>KN17LG".
# 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]
@@ -380,49 +381,60 @@ class Spot:
self.propagation_mode = mode_tag
logger.info(f"Seen a new propagation mode tag not yet in the system: {mode_tag}")
# Parse "de_grid -> dx_grid" structures from the comment
if self.comment:
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_match:
# regex matches, so extract grids:
if not self.de_grid:
self.de_grid = grid_match.group(1).upper()
if not self.dx_grid:
self.dx_grid = grid_match.group(2).upper()
self.dx_location_source = LocationSourceForSpot.GRID
# 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 propagation mode
if self.propagation_mode == "Satellite" and not self.sig:
self.sig = ActivityName.SATELLITE
if self.propagation_mode == "Earth-Moon-Earth" and not self.sig:
self.sig = ActivityName.EME
if self.propagation_mode == "Satellite" and not self.activity:
self.activity = ActivityName.SATELLITE
if self.propagation_mode == "Earth-Moon-Earth" and not self.activity:
self.activity = ActivityName.EME
# Set activities based on the DX callsign suffix
if self.dx_call and not self.sig:
if self.dx_call and not self.activity:
if self.dx_call.upper().endswith(ActivityName.AERONAUTICAL_MOBILE):
self.sig = ActivityName.AERONAUTICAL_MOBILE
self.activity = ActivityName.AERONAUTICAL_MOBILE
elif self.dx_call.upper().endswith(ActivityName.MARITIME_MOBILE):
self.sig = ActivityName.MARITIME_MOBILE
self.activity = ActivityName.MARITIME_MOBILE
# Alright, now let's get really fancy. Check if the DX callsign matches one taking part in a currently
# running DXpedition which we know from the alerts list.
if self.dx_call and not self.sig:
if self.dx_call and not self.activity:
now = datetime.now(pytz.UTC).timestamp()
for alert in DATA_STORE.alerts.values():
if (
alert.sig == ActivityName.DXPEDITION
alert.activity == ActivityName.DXPEDITION
and alert.dx_calls
and alert.start_time
and alert.end_time
and alert.start_time < now < alert.end_time
and self.dx_call.upper() in [c.upper() for c in alert.dx_calls if c]
):
self.sig = ActivityName.DXPEDITION
self.activity = ActivityName.DXPEDITION
break
# Parse "de_grid -> dx_grid" structures from the comment
if self.comment:
grid_mode_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:
# regex matches, so extract grids:
if not self.dx_grid:
self.dx_grid = grid_mode_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()
# 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):
try:
@@ -465,10 +477,10 @@ class Spot:
# Determine a "QTH" string. If we have an activity ref, pick the first one and turn it into a suitable
# string, otherwise see what they have set on an online lookup service.
if self.sig_refs:
qth = self.sig_refs[0].id
if self.sig_refs[0].name:
qth += f" {self.sig_refs[0].name}"
if self.activity_refs:
qth = self.activity_refs[0].id
if self.activity_refs[0].name:
qth += f" {self.activity_refs[0].name}"
self.dx_qth = qth
else:
self.dx_qth = dx_call_info.qth
@@ -501,7 +513,7 @@ class Spot:
and self.dx_longitude
and (
self.dx_location_source == LocationSourceForSpot.SPOT
or self.dx_location_source == LocationSourceForSpot.SIG_REF_LOOKUP
or self.dx_location_source == LocationSourceForSpot.ACTIVITY_REF_LOOKUP
or self.dx_location_source == LocationSourceForSpot.GRID
or (self.dx_location_source == LocationSourceForSpot.HOME_QTH and "/" not in (self.dx_call or ""))
)
@@ -521,7 +533,7 @@ class Spot:
# Icon for the spot should be the icon of its activity if known, otherwise a radio tower
self.icon = "fa-tower-cell"
if self.sig and (activity_icon := get_icon_for_activity(self.sig)):
if self.activity and (activity_icon := get_icon_for_activity(self.activity)):
self.icon = activity_icon
except Exception:
@@ -536,13 +548,13 @@ class Spot:
"""Append an activity ref to the list, so long as it's not already there."""
new_activity_ref.id = new_activity_ref.id.strip().upper()
new_activity_ref.sig = new_activity_ref.sig.strip().upper()
new_activity_ref.activity = new_activity_ref.activity.strip().upper()
if new_activity_ref.id == "":
return
for activity_ref in self.sig_refs:
if activity_ref.id == new_activity_ref.id and activity_ref.sig == new_activity_ref.sig:
for activity_ref in self.activity_refs:
if activity_ref.id == new_activity_ref.id and activity_ref.activity == new_activity_ref.activity:
return
self.sig_refs.append(new_activity_ref)
self.activity_refs.append(new_activity_ref)
def expired(self):
"""Decide if this spot has expired (in which case it should not be added to the system in the first place, and not
-39
View File
@@ -1,39 +0,0 @@
## Writing your own client
One of the key strengths of Spothole is that the API is well-defined and open to anyone to use. This means you can build
your own software that uses data from Spothole.
As well as the main API endpoints to fetch spots and alerts, with various possible query parameters, there are also
Server-Sent Events (SSE) API endpoints to receive a live feed, plus various utility lookup endpoints for things like
callsign and park data.
Various approaches exist to writing your own client, but in general:
* Refer to the API docs. These are built on an OpenAPI definition file (`/static/apidocs/openapi.yml`), which you can
automatically use to generate a client skeleton using various software.
* Call the main "spots" or "alerts" API endpoints to get the data you want. For example, your app could call
`https://spothole.app/api/v2/spots` once every few minutes. Apply filters if necessary.
* Call the "options" API to get an idea of which bands, modes etc. the server knows about. You might want to do that
first before calling the spots/alerts APIs, to allow you to populate your filters correctly.
* Refer to the provided HTML/JS interface for a reference on different approaches. For example, the "alerts"/"upcoming"
page simply query the main spot API on a timer, whereas the spots, map and bands pages combine this approach with
using the Server-Sent Events (SSE) endpoint to update live.
* Let me know if you get stuck, I'm happy to help.
Please don't hammer the API with an unnecessarily high request rate. For example, Spothole only queries the POTA API
once every two minutes, so if your client is interested in POTA data there's no need to poll Spothole any more often
than that.
If you absolutely must be informed within seconds of a spot arriving in Spothole, please use the SSE endpoints instead,
e.g. `https://spothole.app/api/v2/spots/stream`.
If you want to handle different types of spot or alert differently within your client, please consider making a single
request to the Spothole API to retrieve all the data, then filtering on your side. For example, call
`https://spothole.app/api/v2/spots?sig=POTA,SOTA` rather than making two separate calls to
`https://spothole.app/api/v2/spots?sig=POTA` and `https://spothole.app/api/v2/spots?sig=SOTA`.
Remember, here at Spothole Inc. we offer an industry-standard "five nines" uptime on our server, with our own unique
twist: we don't tell you which side of the decimal point the nines start! (Translation: This is a hobby project.
`spothole.app` runs on the same server as my blog and other stuff. It might go down without warning. By all means base
your own project on data from the main server if you like, but if you want any control over reliability and downtime,
please run your own copy instead.)
-41
View File
@@ -1,41 +0,0 @@
## Embedding Spothole in another website
You can embed Spothole's web interface in another website, e.g. for use as part of a ham radio custom dashboard.
URL parameters can be used to trigger an "embedded" mode which hides the headers, footers and settings. In this mode,
you provide configuration for the various filter and display options via additional URL parameters. Any settings that
the user has set for Spothole are ignored. This is so that the embedding site can select, for example, their choice of
dark mode or activity filters, which will not impact how Spothole appears when the user accesses it directly. Effectively, it
becomes separate to their normal Spothole settings.
Setting `embedded` to true is important for the rest of the settings to be applied; otherwise, the user's defaults will
be used in preference to the URL params.
These are supplied with the URL to the page you want to embed, for example for an embedded version of the band map in
dark mode, use `https://spothole.app/bands?embedded=true&dark-mode=true`. For an embedded version of the main spots/home
page in the system light/dark mode, use `https://spothole.app/?embedded=true`. For dark mode showing 70cm TOTA spots
only, use `https://spothole.app/?embedded=true&dark-mode=true&sig=TOTA&band=70cm`. Providing no URL params causes the
page to be loaded in the normal way it would when accessed directly in the user's browser.
The supported parameters are as follows. Generally these match the equivalent parameters in the real Spothole API, where
a mapping exists.
| Name | Allowed Values | Default | Example | Description |
|------------------|-------------------------|---------|-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `embedded` | `true`, `false` | `false` | `?embedded=true` | Enables embedded mode. |
| `color_scheme` | `light`, `dark`, `auto` | `auto` | `?color_scheme=dark` | Forces light or dark mode in preference to the operating system default. |
| `time_zone` | `UTC`, `local` | `UTC` | `?time_zone=local` | Sets times to be in UTC or local time. |
| `limit` | 10, 25, 50, 100 | 50 | `?limit=50` | Sets the number of spots that will be displayed on the main spots page |
| `limit` | 25, 50, 100, 200, 500 | 100 | `?limit=100` | Sets the number of alerts that will be displayed on the alerts page |
| `max_age` | 300, 600, 1800, 3600 | 1800 | `?max_age=1800` | Sets the maximum age of spots displayed on the map and bands pages, in seconds. |
| `band` | Comma-separated list | (all) | `?band=20m,40m` | Sets the list of bands that will be shown on the spots, bands and map pages. Available options match the labels of the buttons in the standard web interface. |
| `sig` | Comma-separated list | (all) | `?sig=POTA,SOTA,NO_SIG` | Sets the list of activities that will be shown on the spots, bands and map pages. Available options match the labels of the buttons in the standard web interface. |
| `source` | Comma-separated list | (all) | `?source=Cluster` | Sets the list of sources that will be shown on any spot or alert pages. Available options match the labels of the buttons in the standard web interface. |
| `mode_type` | Comma-separated list | (all) | `?mode_type=PHONE,CW` | Sets the list of mode types that will be shown on the spots, bands and map pages. Available options match the labels of the buttons in the standard web interface. |
| `dx_continent` | Comma-separated list | (all) | `?dx_continent=NA,SA` | Sets the list of DX Continents that will be shown on any spot or alert pages. Available options match the labels of the buttons in the standard web interface. |
| `de_continent` | Comma-separated list | (all) | `?de_continent=EU` | Sets the list of DE Continents that will be shown on the spots, bands and map pages. Available options match the labels of the buttons in the standard web interface. |
| `map-center-lat` | Numeric (decimal) | (auto) | `?map-center-lat=51.5` | Sets the initial latitude of the map centre on the map page. If omitted, the map auto-fits to the loaded spots. |
| `map-center-lon` | Numeric (decimal) | (auto) | `?map-center-lon=-0.1` | Sets the initial longitude of the map centre on the map page. If omitted, the map auto-fits to the loaded spots. |
| `map-zoom` | Numeric (integer) | (auto) | `?map-zoom=6` | Sets the initial zoom level of the map on the map page. If omitted, the map auto-fits to the loaded spots. |
See the comment at the end of the next section regarding reliability and uptime of the "main" server.
-79
View File
@@ -1,79 +0,0 @@
## Modifying the source code
Spothole is Public Domain licenced, so you can grab the source code and start modifying it for your own needs.
Contributions of code back to the main repository are encouraged, but completely optional.
### Code structure
To navigate your way around the source code, this list may help.
*Python back-end code*
* `/core` - Core classes and utilities
* `/data` - Data storage classes
* `/providers/spot` - Classes providing spots by accessing the APIs of other services
* `/providers/alert` - Classes providing alerts by accessing the APIs of other services
* `/providers/solarconditions` - Classes providing solar and propagation by accessing the APIs of other services
* `/providers/staticdata` - Classes providing static lookup data by accessing bundled data files or the APIs of other
services
* `/providers/callsign` - Classes providing callsign lookup data by accessing bundled data files or the APIs of other
services
* `/providers/activityrefdata` - Classes providing activity reference lookup data by accessing bundled data files or
the APIs of other services
* `/webserver` - Classes for running Spothole's own web server
* `/telnetserver` - Classes for running Spothole's telnet server
* `spothole.py` - Main application script
*Templates*
* `/templates` - Templates used for constructing Spothole's user-targeted HTML pages
*HTML/JS/CSS front-end code*
* `/static` - Root for static files served by the web server. These are all served from a path starting `/static/`.
* `/static/apidocs` - Contains the OpenAPI spec (`openapi.yml`)
* `/static/audio` - Audio files used by the web front-end
* `/static/css` - CSS files used by the web front-end
* `/static/img` - image files used by the web front-end
* `/static/js` - JavaScript used by the web front-end
* `/static/vendor` - Third-party libraries (CSS, JS, fonts and images)
*Miscellaneous*
* `/` - pip `requirements.txt`, config, README, etc.
* `/docs` - Documentation
* `/images` - Image sources
* `/datafiles` - Local data files, used by some providers when the data will never change and/or is not easily available
online in a format Spothole can handle
* `/cache` - Directory where Spothole stores all the data it uses that should be persisted to disk. Created on first
run.
### Extending the server
Spothole is designed to be easily extensible. If you want to write your own spot provider, for example, simply add a
module to the `providers.spot` package containing your class. (Currently, in order to be loaded correctly, the module
(file) name should be the same as the class name, but lower case.)
Your class should extend "SpotProvider"; if it operates by polling an HTTP Server on a timer, it can instead extend "
HTTPSpotProvider" where some of the work is done for you.
The class will need to implement a constructor that takes in the `provider_config` and provides it to the superclass
constructor, while also taking any other config parameters it needs.
If you're extending the base `SpotProvider` class, you will need to implement `start()` and `stop()` methods that start
and stop a separate thread which handles the provider's processing needs. The thread should call `submit()` or
`submit_batch()` when it has one or more spots to report.
If you're extending the `HTTPSpotProvider` class, you will need to provide a URI to query and an interval to the
superclass constructor. You'll then need to implement the `http_response_to_spots()` method which is called when new
data is retrieved. Your implementation should then call `submit()` or `submit_batch()` when it has one or more spots to
report.
When constructing spots, use the comments in the Spot class and the existing implementations as an example. All
parameters are optional, but you will at least want to provide a `time` (which must be timezone-aware) and a `dx_call`.
Finally, simply add the appropriate config to the `spot_providers` section of `config.yml`, and your provider should be
instantiated on startup.
The same approach as above is also used for alerts, and other types of providers. Give me a shout if you need any
advice.
-96
View File
@@ -1,96 +0,0 @@
## Multiple cluster nodes with different settings
Dan, S50U has written in with his Spothole cluster settings. He is using a cluster node which provides RBN spots, and
uses different SSIDs on his callsign to get different settings when logged into the same cluster node. For example:
```
-
class: "DXCluster"
name: "S50CLX"
enabled: true
host: "s50clx.si"
port: 41112
login_prompt: "login: "
login_callsign: "callsign-10"
```
Telnet to DXSpider and log in with "callsign-10" and execute the following commands:
`CLEAR/SPOTS ALL` (delete all previous filters)<br/>
`UNSET/ANN` (stop announce messages)<br/>
`UNSET/WCY` (stop wcy messages)<br/>
`UNSET/WWV` (stop wwv messages)<br/>
`SET/DX` (enable human DX spots)
```
-
class: "DXCluster"
name: "RBN CW"
enabled: true
host: "s50clx.si"
port: 41112
login_prompt: "login: "
login_callsign: "callsign-11"
allow_rbn_spots: true
enabled_by_default_in_web_ui: false
```
Telnet to DXSpider and log in with "callsign-11" and execute the following commands:
`CLEAR/SPOTS ALL` (delete all previous filters)<br/>
`UNSET/ANN` (stop announce messages)<br/>
`UNSET/WCY` (stop wcy messages)<br/>
`UNSET/WWV` (stop wwv messages)<br/>
`UNSET/DX` (stop human DX spots)<br/>
`SET/SKIMMER CW` (enable CW RBN spots)
```
-
class: "DXCluster"
name: "RBN RTTY"
enabled: true
host: "s50clx.si"
port: 41112
login_prompt: "login: "
login_callsign: "callsign-12"
allow_rbn_spots: true
enabled_by_default_in_web_ui: false
```
Telnet to DXSpider and log in with "callsign-12" and execute the following commands:
`CLEAR/SPOTS ALL` (delete all previous filters)<br/>
`UNSET/ANN` (stop announce messages)<br/>
`UNSET/WCY` (stop wcy messages)<br/>
`UNSET/WWV` (stop wwv messages)<br/>
`UNSET/DX` (stop human DX spots)<br/>
`SET/SKIMMER RTTY` (enable RTTY RBN spots)
```
-
class: "DXCluster"
name: "RBN FT4/8"
enabled: true
host: "s50clx.si"
port: 41112
login_prompt: "login: "
login_callsign: "callsign-13"
allow_rbn_spots: true
enabled_by_default_in_web_ui: false
```
Telnet to DXSpider and log in with "callsign-13" and execute the following commands:
`CLEAR/SPOTS ALL` (delete all previous filters)<br/>
`UNSET/ANN` (stop announce messages)<br/>
`UNSET/WCY` (stop wcy messages)<br/>
`UNSET/WWV` (stop wwv messages)<br/>
`UNSET/DX` (stop human DX spots)<br/>
`SET/SKIMMER FT` (enable FT RBN spots)
For each callsign-SSID, we also specify our basic information with commands:
`SET/NAME Spothole10`, Spothole11... etc.<br/>
`SET/QTH Cerkno`<br/>
`SET/QRA JN66XD`<br/>
`SET/HOME S50CLX`
-118
View File
@@ -1,118 +0,0 @@
## nginx Reverse Proxy configuration
Web servers generally serve their pages from port 80. However, it's best not to serve Spothole's web interface directly
on port 80, as that requires root privileges on a Linux system. It also and prevents us using HTTPS to serve a secure
site, since Spothole itself doesn't directly support acting as an HTTPS server. The normal solution to this is to use a
"reverse proxy" setup, where a general web server handles HTTP and HTTP requests (to port 80 & 443 respectively), then
passes on the request to the back-end application (in this case Spothole). nginx is a common choice for this general web
server.
To set up nginx as a reverse proxy that sits in front of Spothole, first ensure it's installed e.g.
`sudo apt install nginx`, and enabled e.g. `sudo systemd enable nginx`.
Create a file at `/etc/nginx/sites-available/` called `spothole`. Give it the following contents, replacing
`spothole.app` with the domain name on which you want to run Spothole. If you changed the port on which Spothole runs,
update that on the "proxy_pass" line, and if you installed Spothole somewhere other than `/home/spothole/spothole`,
adjust the alias location for serving static files.
(The latter section, configuring the nginx server to serve static files directly, improves efficiency because it saves
Spothole itself from serving JS, CSS etc. files. If you can't do this for some reason, e.g. your nginx and spothole are
on different computers, you can omit the `location /static/ {}` block.)
```nginx
server {
server_name spothole.app;
# Global proxy settings
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_connect_timeout 10s;
proxy_buffering on;
# Pass on IP address and host information to Spothole, in case logging this information is required
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
# Wellknown area for Lets Encrypt
location /.well-known/ {
alias /var/www/html/.well-known/;
}
# Load static assets directly from the Spothole static directory
location /static/ {
alias /home/spothole/spothole/static/;
expires 1h;
add_header Cache-Control "public, max-age=3600, must-revalidate";
}
# SSE endpoints
location ~ ^/api/v\d*/(spots|alerts)/stream/? {
proxy_pass http://127.0.0.1:8080;
# Remove buffering, remove caching, add suitable timeouts for SSE API calls
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 24h;
proxy_send_timeout 24h;
proxy_set_header X-Accel-Buffering no;
add_header Cache-Control no-store always;
# Allow cross-origin requests to API
proxy_hide_header Access-Control-Allow-Origin;
add_header Access-Control-Allow-Origin * always;
}
# Other API endpoints
location /api/ {
proxy_pass http://127.0.0.1:8080;
# Remove buffering, remove caching, add suitable timeouts for API calls
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 30s;
add_header Cache-Control no-store always;
# Allow cross-origin requests to API
proxy_hide_header Access-Control-Allow-Origin;
add_header Access-Control-Allow-Origin * always;
}
# Templated pages
location / {
proxy_pass http://127.0.0.1:8080;
proxy_read_timeout 30s;
add_header Cache-Control "no-cache, must-revalidate" always;
}
}
```
One further change you might want to make to the file above is the `add_header Access-Control-Allow-Origin` statements.
These are what's used on my own Spothole server to make sure that other third-party web-based software can get the data
from my instance, and applies to any endpoint underneath `/api`. If you want *your* Spothole instance to be set up the
same way, so that others can write software in JavaScript that can access it, leave this intact. But if you want your
Spothole instance to only be usable by scripts running on the web server you write, you can remove these lines. (Note
that this doesn't stop other people writing *non-web-based* software that accesses your Spothole API&mdash;the
enforcement of cross-origin headers only happens within the user's browser. If you need to lock your instance down so
that no-one else can access it with *any* software, that's an aspect of nginx or firewall config that you will need to
find help with elsewhere.)
Now, make a symbolic link to enable the site:
```bash
cd /etc/nginx/sites-enabled
sudo ln -sf ../sites-available/spothole
```
Test that your nginx config isn't broken using `nginx -t`. If it works, restart nginx with
`sudo systemctl restart nginx`.
If you haven't already done so, set up a DNS entry to make sure requests for your domain name end up at the server
that's running Spothole.
You should now be able to access the web interface by going to the domain from your browser.
Once that's working, [install certbot](https://certbot.eff.org/instructions?ws=nginx&os=snap) onto your server. Run it
as root, and when prompted pick your domain name from the list. After a few seconds, it should successfully provision a
certificate and modify your nginx config files automatically. You should then be able to access the site via HTTPS.
-54
View File
@@ -1,54 +0,0 @@
## Running your own copy
If you want to run a copy of Spothole with different configuration settings than the main instance, you can download it
and run it on your own local machine or server.
You will require Python version 3.10 or later. If you encounter an error about `gdal-config` during the following
process, you will also need `libgdal-dev` installed.
To download and set up Spothole on a Debian server, run the following commands. Other operating systems will likely be
similar.
```bash
git clone ssh://git@git.ianrenton.com/ian/spothole.git
cd spothole
python3 -m venv ./.venv
source .venv/bin/activate
pip install -r requirements.txt
deactivate
cp config-example.yml config.yml
```
Then edit `config.yml` in your text editor of choice to set up the software as you like it. Mostly, this will involve
enabling or disabling the various providers of spot and alert data.
By default, all outdoor programme providers are enabled, as is one cluster node and the NG3K DXpedition data. The RBN
spot providers are turned off by default due to the volume of traffic from CW/RTTY/FT8 skimmers, and the APRS and Packet
spot providers are off by default on the assumption that Spothole users want a spot with a human at the other end of it,
but all can be easily re-enabled.
Other parameters you will want to update include the base URL to your instance, and whether you want to serve a full
web-based DX cluster interface or just the API endpoints for client software to use.
`config.yml` has an entry for a Clublog API key. If provided, this will allow Spothole to retrieve some more information
about DX spots. The software will work just fine without it, but you may find a few country flags etc. are less accurate
or missing. Clublog API keys are free, but you'll need to get your own by submitting a helpdesk ticket and explaining
what you'll use it for. The admin team are happy with the rate of requests made by my Spothole server, so unless you
change the source code of yours to radically increase the rate of querying Clublog, I'm sure they will be fine with your
server too.
Once you're happy with the content of `config.yml`, you can proceed to running the software.
To run the software this time and any future times you want to run it directly from the command line:
```bash
source .venv/bin/activate
python3 spothole.py
```
The software can take a few seconds to start up, particularly if it's been run previously and has a large amount of
cache data to sort through. This is normal, don't panic! Once you see `You can access your copy of Spothole at
http://localhost:8080` in the log, your server is good to go.
If you see some errors on startup, check your configuration, e.g. in case you have specified a port for the web server
that is already in use by something else.
-34
View File
@@ -1,34 +0,0 @@
## systemd configuration
If you want Spothole to run automatically on startup on a Linux distribution that uses `systemd`, follow the
instructions here. For distros that don't use `systemd`, or Windows/OSX/etc., you can find generic instructions for your
OS online.
Create a file at `/etc/systemd/system/spothole.service`. Give it the following content, adjusting for the user you want
to run it as and the directory in which you have installed it:
```
[Unit]
Description=Spothole
After=syslog.target network.target
[Service]
Type=simple
User=spothole
WorkingDirectory=/home/spothole/spothole
ExecStart=/home/spothole/spothole/.venv/bin/python /home/spothole/spothole/spothole.py --serve-in-foreground
Restart=on-abort
[Install]
WantedBy=multi-user.target
```
Run the following:
```bash
sudo systemctl daemon-reload
sudo systemctl enable spothole
sudo systemctl start spothole
```
Check the service has started up correctly with `sudo journalctl -u spothole -f`.
@@ -13,11 +13,10 @@ class ActivityRefDataProvider:
"""Generic activity reference data provider class. Subclasses of this query the individual URLs or files for
data."""
def __init__(self, sig_name, provider_config):
"""Constructor. Note the parameter and attribute are still named "sig_name" for consistency with the API's
"sig" field name."""
def __init__(self, activity_name, provider_config):
"""Constructor"""
self.sig_name = sig_name
self.activity_name = activity_name
self.enabled = provider_config["enabled"]
self.last_update_time = datetime.min.replace(tzinfo=pytz.UTC)
self.status = "Not Started" if self.enabled else "Disabled"
@@ -43,7 +42,7 @@ class ActivityRefDataProvider:
# transact()s is to fail if they can't get the lock (?!). This behaviour is fixed by retry=True.
with DATA_STORE.activity_refs.transact(retry=True):
for d in new_data:
DATA_STORE.activity_refs.set(f"{self.sig_name}:{d.id}", d)
DATA_STORE.activity_refs.set(f"{self.activity_name}:{d.id}", d)
# For the big data sources, loading will take a few minutes. If we want to shut down the software neatly
# within the first few minutes of startup, we need a way to abort this expensive process of filling up the
@@ -52,4 +51,4 @@ class ActivityRefDataProvider:
break
self.reference_count = len(new_data)
logger.info(f"Loaded {self.reference_count} references for {self.sig_name} into the data store.")
logger.info(f"Loaded {self.reference_count} references for {self.activity_name} into the data store.")
+1 -1
View File
@@ -25,7 +25,7 @@ class ARLHS(FileDownloadActivityRefDataProvider):
ref_id = row["ARLHS"]
new_data.append(
ActivityRef(
sig=self.ACTIVITY,
activity=self.ACTIVITY,
id=ref_id,
name=row.get("Name", None),
ref_type=ActivityRefType.LIGHTHOUSE,
+1 -1
View File
@@ -30,7 +30,7 @@ class COTA(FileDownloadActivityRefDataProvider):
new_data.append(
ActivityRef(
sig=self.ACTIVITY,
activity=self.ACTIVITY,
id=ref_id,
name=name,
ref_type=ActivityRefType.CASTLE,
+6 -1
View File
@@ -27,7 +27,12 @@ class DCE(FileDownloadActivityRefDataProvider):
for index, row in df.iterrows():
if row.iloc[0] and row.iloc[2]:
new_data.append(
ActivityRef(sig=self.ACTIVITY, id=row.iloc[0].strip(), name=row.iloc[2].strip(), ref_type=ActivityRefType.CASTLE)
ActivityRef(
activity=self.ACTIVITY,
id=row.iloc[0].strip(),
name=row.iloc[2].strip(),
ref_type=ActivityRefType.CASTLE,
)
)
# Bail out if a stop has been requested, i.e. the program is shutting down - no need to parse the rest of
+6 -1
View File
@@ -31,7 +31,12 @@ class DEFE(FileDownloadActivityRefDataProvider):
if row.iloc[0] and row.iloc[1]:
new_data.append(
ActivityRef(sig=self.ACTIVITY, id=row.iloc[0].strip(), name=row.iloc[1].strip(), ref_type=ActivityRefType.BUILDING)
ActivityRef(
activity=self.ACTIVITY,
id=row.iloc[0].strip(),
name=row.iloc[1].strip(),
ref_type=ActivityRefType.BUILDING,
)
)
# Bail out if a stop has been requested, i.e. the program is shutting down - no need to parse the rest of
+1 -1
View File
@@ -40,7 +40,7 @@ class DME(LocalFileActivityRefDataProvider):
)
ref = ActivityRef(
sig=self.ACTIVITY,
activity=self.ACTIVITY,
id=ref_id,
ref_type=ActivityRefType.TOWN,
name=f"{row['NOMBRE_ACTUAL']}, {row['PROVINCIA']}",
+6 -1
View File
@@ -22,7 +22,12 @@ class DMUE(FileDownloadActivityRefDataProvider):
for row in csv.reader(http_response.content.decode("utf-8-sig").splitlines(), delimiter=";"):
if len(row) > 1 and row[0] and row[1]:
new_data.append(
ActivityRef(sig=self.ACTIVITY, id=row[0].strip(), name=row[1].strip(), ref_type=ActivityRefType.BUILDING)
ActivityRef(
activity=self.ACTIVITY,
id=row[0].strip(),
name=row[1].strip(),
ref_type=ActivityRefType.BUILDING,
)
)
# Bail out if a stop has been requested, i.e. the program is shutting down - no need to parse the rest of
+5 -1
View File
@@ -36,7 +36,11 @@ class DMVE(FileDownloadActivityRefDataProvider):
continue
if ref and name:
new_data.append(ActivityRef(sig=self.ACTIVITY, id=ref.strip(), name=name.strip(), ref_type=ActivityRefType.BUILDING))
new_data.append(
ActivityRef(
activity=self.ACTIVITY, id=ref.strip(), name=name.strip(), ref_type=ActivityRefType.BUILDING
)
)
# 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
+3 -1
View File
@@ -21,7 +21,9 @@ class DTMBA(FileDownloadActivityRefDataProvider):
split = row.split(";")
ref_id = split[0]
ref_name = split[1]
new_data.append(ActivityRef(sig=self.ACTIVITY, id=ref_id, name=ref_name, ref_type=ActivityRefType.BUILDING))
new_data.append(
ActivityRef(activity=self.ACTIVITY, id=ref_id, name=ref_name, ref_type=ActivityRefType.BUILDING)
)
# 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
+10 -2
View File
@@ -41,8 +41,16 @@ class FEA(FileDownloadActivityRefDataProvider):
# prefix and just use FEA-1234 or FEA 1234, so we add both copies to the database.
ref_id_1 = row[0].strip()
ref_id_2 = ref_id_1.replace("D-", "FEA-").replace("E-", "FEA-")
new_data.append(ActivityRef(sig=self.ACTIVITY, id=ref_id_1, name=row[1].strip(), ref_type=ActivityRefType.LIGHTHOUSE))
new_data.append(ActivityRef(sig=self.ACTIVITY, id=ref_id_2, name=row[1].strip(), ref_type=ActivityRefType.LIGHTHOUSE))
new_data.append(
ActivityRef(
activity=self.ACTIVITY, id=ref_id_1, name=row[1].strip(), ref_type=ActivityRefType.LIGHTHOUSE
)
)
new_data.append(
ActivityRef(
activity=self.ACTIVITY, id=ref_id_2, name=row[1].strip(), ref_type=ActivityRefType.LIGHTHOUSE
)
)
# 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
@@ -16,19 +16,21 @@ class FileDownloadActivityRefDataProvider(ActivityRefDataProvider):
"""Generic activity ref data provider class for providers that fetch their data from the web by downloading a
file."""
def __init__(self, sig_name, provider_config, url, poll_interval):
def __init__(self, activity_name, provider_config, url, poll_interval):
"""Set up the provider, note poll_interval is in *days*."""
super().__init__(sig_name, provider_config)
super().__init__(activity_name, provider_config)
self._url = url
self._poll_interval = poll_interval
self._thread = None
self._url_data_cache = URLDataCache(f"activity_ref_data_{sig_name}")
self._url_data_cache = URLDataCache(f"activity_ref_data_{activity_name}")
def start(self):
# Fire off the polling thread. It will poll immediately on startup, then sleep for poll_interval between
# subsequent polls, so start() returns immediately and the application can continue starting.
logger.info(f"Set up query of {self.sig_name} activity ref data every {self._poll_interval!s} days.")
self._thread = Thread(target=self._run, name=f"FileDownloadActivityRefDataProvider-{self.sig_name}", daemon=True)
logger.info(f"Set up query of {self.activity_name} activity ref data every {self._poll_interval!s} days.")
self._thread = Thread(
target=self._run, name=f"FileDownloadActivityRefDataProvider-{self.activity_name}", daemon=True
)
self._thread.start()
def stop(self):
@@ -36,7 +38,9 @@ class FileDownloadActivityRefDataProvider(ActivityRefDataProvider):
if self._thread:
self._thread.join(timeout=12)
if self._thread.is_alive():
logger.warning(f"{self.sig_name} activity ref data worker thread did not exit on time and will be killed.")
logger.warning(
f"{self.activity_name} activity ref data worker thread did not exit on time and will be killed."
)
def _run(self):
while True:
@@ -48,7 +52,7 @@ class FileDownloadActivityRefDataProvider(ActivityRefDataProvider):
try:
# Request data from API. Use the data cache (with a TTL of 1 day) here, not as the main mechanism for
# caching, but just so continual restarts of the software during testing don't hammer the servers.
logger.debug(f"Downloading {self.sig_name} activity ref data...")
logger.debug(f"Downloading {self.activity_name} activity ref data...")
http_response = self._url_data_cache.get(self._url, headers=HTTP_HEADERS)
# Check response code was good
if http_response.ok:
@@ -60,20 +64,22 @@ class FileDownloadActivityRefDataProvider(ActivityRefDataProvider):
self.status = "OK"
self.last_update_time = datetime.now(pytz.UTC)
logger.debug(f"Received activity ref data for {self.sig_name}")
logger.debug(f"Received activity ref data for {self.activity_name}")
else:
self.status = "Error"
logger.warning(f"HTTP {http_response.status_code} when downloading activity ref data for {self.sig_name}.")
logger.warning(
f"HTTP {http_response.status_code} when downloading activity ref data for {self.activity_name}."
)
except ConnectionError:
self.status = "Error"
logger.warning(f"Connection error when downloading activity ref data for {self.sig_name}.")
logger.warning(f"Connection error when downloading activity ref data for {self.activity_name}.")
except (ConnectTimeout, ReadTimeout):
self.status = "Error"
logger.warning(f"Timeout when downloading activity ref data for {self.sig_name}.")
logger.warning(f"Timeout when downloading activity ref data for {self.activity_name}.")
except Exception:
self.status = "Error"
logger.exception(f"Exception in HTTP Activity Ref Data Provider ({self.sig_name})")
logger.exception(f"Exception in HTTP Activity Ref Data Provider ({self.activity_name})")
self._stop_event.wait(timeout=1)
def _http_response_to_data(self, http_response):
+1 -1
View File
@@ -24,7 +24,7 @@ class GMA(FileDownloadActivityRefDataProvider):
ref_id = row["Reference"]
new_data.append(
ActivityRef(
sig=self.ACTIVITY,
activity=self.ACTIVITY,
id=ref_id,
name=row.get("Name", None),
ref_type=ActivityRefType.SUMMIT,
+1 -1
View File
@@ -25,7 +25,7 @@ class ILLW(FileDownloadActivityRefDataProvider):
ref_id = row["ILLW"]
new_data.append(
ActivityRef(
sig=self.ACTIVITY,
activity=self.ACTIVITY,
id=ref_id,
name=row.get("Name", None),
ref_type=ActivityRefType.LIGHTHOUSE,
+1 -1
View File
@@ -42,7 +42,7 @@ class IOTA(FileDownloadActivityRefDataProvider):
new_data.append(
ActivityRef(
sig=self.ACTIVITY,
activity=self.ACTIVITY,
id=ref_id,
name=ref["name"],
ref_type=ActivityRefType.ISLAND,
+1 -1
View File
@@ -30,7 +30,7 @@ class LLOTA(FileDownloadActivityRefDataProvider):
new_data.append(
ActivityRef(
sig=self.ACTIVITY,
activity=self.ACTIVITY,
id=ref_id,
name=str(ref["name"]),
ref_type=ActivityRefType.LAKE,
@@ -11,12 +11,12 @@ logger = logging.getLogger(__name__)
class LocalFileActivityRefDataProvider(ActivityRefDataProvider):
"""Generic activity ref data provider class for providers that fetch their data from a local file on startup."""
def __init__(self, sig_name, provider_config, path):
super().__init__(sig_name, provider_config)
def __init__(self, activity_name, provider_config, path):
super().__init__(activity_name, provider_config)
self._path = path
def start(self):
logger.debug(f"Loading {self.sig_name} activity ref data from file.")
logger.debug(f"Loading {self.activity_name} activity ref data from file.")
try:
new_data = self._file_to_data(self._path)
if new_data:
@@ -25,10 +25,10 @@ class LocalFileActivityRefDataProvider(ActivityRefDataProvider):
self.last_update_time = datetime.now(pytz.UTC)
else:
self.status = "Error"
logger.info(f"Failed to load activity ref data for {self.sig_name}")
logger.info(f"Failed to load activity ref data for {self.activity_name}")
except Exception:
self.status = "Error"
logger.exception(f"Exception in local file Activity Ref Data Provider ({self.sig_name})")
logger.exception(f"Exception in local file Activity Ref Data Provider ({self.activity_name})")
def _file_to_data(self, path):
"""Load a file on the given path and turn it into activity ref data."""
+1 -1
View File
@@ -24,7 +24,7 @@ class MOTA(FileDownloadActivityRefDataProvider):
ref_id = row["Reference"]
new_data.append(
ActivityRef(
sig=self.ACTIVITY,
activity=self.ACTIVITY,
id=ref_id,
name=row.get("Name", None),
ref_type=ActivityRefType.MILL,
+1 -1
View File
@@ -39,7 +39,7 @@ class PGA(FileDownloadActivityRefDataProvider):
new_data.append(
ActivityRef(
sig=self.ACTIVITY,
activity=self.ACTIVITY,
id=ref_id,
name=name,
ref_type=ActivityRefType.REGION,
@@ -17,9 +17,9 @@ class ParksNPeaksKMLActivityRefDataProvider(FileDownloadActivityRefDataProvider)
REF_PATTERN = re.compile(r"VKFF-\d+")
def __init__(self, sig_name, provider_config, url, poll_interval):
def __init__(self, activity_name, provider_config, url, poll_interval):
"""Set up the provider, note poll_interval is in *days*."""
super().__init__(sig_name, provider_config, url, poll_interval)
super().__init__(activity_name, provider_config, url, poll_interval)
def _http_response_to_data(self, http_response):
new_data = []
@@ -41,7 +41,7 @@ class ParksNPeaksKMLActivityRefDataProvider(FileDownloadActivityRefDataProvider)
longitude, latitude = placemark.geometry.x, placemark.geometry.y
ref = ActivityRef(
sig=self.sig_name,
activity=self.activity_name,
id=ref_id,
name=placemark.name,
ref_type=ActivityRefType.PARK,
+1 -1
View File
@@ -24,7 +24,7 @@ class POTA(FileDownloadActivityRefDataProvider):
ref_id = row["reference"]
new_data.append(
ActivityRef(
sig=self.ACTIVITY,
activity=self.ACTIVITY,
id=ref_id,
name=row.get("name", None),
ref_type=ActivityRefType.PARK,
+1 -1
View File
@@ -24,7 +24,7 @@ class SIOTA(FileDownloadActivityRefDataProvider):
ref_id = row["SILO_CODE"]
new_data.append(
ActivityRef(
sig=self.ACTIVITY,
activity=self.ACTIVITY,
id=ref_id,
name=row.get("NAME", None),
ref_type=ActivityRefType.SILO,
+1 -1
View File
@@ -28,7 +28,7 @@ class SOTA(FileDownloadActivityRefDataProvider):
longitude = float(row["Longitude"]) if "Longitude" in row and row["Longitude"] != "" else None
altitude = float(row["AltM"]) if "AltM" in row and row["AltM"] != "" else None
ref = ActivityRef(
sig=self.ACTIVITY,
activity=self.ACTIVITY,
id=ref_id,
name=row.get("SummitName", None),
ref_type=ActivityRefType.SUMMIT,
+1 -1
View File
@@ -24,7 +24,7 @@ class Toilets(LocalFileActivityRefDataProvider):
for row in dr:
new_data.append(
ActivityRef(
sig=self.ACTIVITY,
activity=self.ACTIVITY,
id=row["ref"],
name=row["ref"],
ref_type=ActivityRefType.TOILET,
+1 -1
View File
@@ -24,7 +24,7 @@ class Towers(FileDownloadActivityRefDataProvider):
ref_id = row["Ref"]
new_data.append(
ActivityRef(
sig=self.ACTIVITY,
activity=self.ACTIVITY,
id=ref_id,
name=row.get("Nazev", None),
ref_type=ActivityRefType.TOWER,
+1 -1
View File
@@ -43,7 +43,7 @@ class WCA(FileDownloadActivityRefDataProvider):
new_data.append(
ActivityRef(
sig=self.ACTIVITY,
activity=self.ACTIVITY,
id=ref_id,
name=row.get("CLEAN NAME", None),
ref_type=ActivityRefType.CASTLE,
+1 -1
View File
@@ -30,7 +30,7 @@ class WOTA(FileDownloadActivityRefDataProvider):
new_data.append(
ActivityRef(
sig=self.ACTIVITY,
activity=self.ACTIVITY,
id=ref_id,
name=feature["properties"]["title"],
url=url,
+1 -1
View File
@@ -24,7 +24,7 @@ class WWBOTA(FileDownloadActivityRefDataProvider):
ref_id = row["Reference"]
new_data.append(
ActivityRef(
sig=self.ACTIVITY,
activity=self.ACTIVITY,
id=ref_id,
name=row.get("Name", None),
ref_type=ActivityRefType.BUNKER,
+1 -1
View File
@@ -24,7 +24,7 @@ class WWFF(FileDownloadActivityRefDataProvider):
ref_id = row["reference"]
new_data.append(
ActivityRef(
sig=self.ACTIVITY,
activity=self.ACTIVITY,
id=ref_id,
name=row.get("name", None),
ref_type=ActivityRefType.PARK,
+1 -1
View File
@@ -33,7 +33,7 @@ class ZLOTA(FileDownloadActivityRefDataProvider):
ref_type = None
new_ref = ActivityRef(
sig=self.ACTIVITY,
activity=self.ACTIVITY,
id=ref_id,
name=ref["name"],
ref_type=ref_type,
+2 -2
View File
@@ -56,8 +56,8 @@ class BOTA(HTTPAlertProvider):
alert = Alert(
source=self.name,
dx_calls=[dx_call],
sig=ActivityName.BOTA,
sig_refs=[ActivityRef(id=ref_name, sig=ActivityName.BOTA)],
activity=ActivityName.BOTA,
activity_refs=[ActivityRef(id=ref_name, activity=ActivityName.BOTA)],
start_time=date_time.timestamp(),
)
+12 -9
View File
@@ -22,25 +22,28 @@ class Hamsat(HTTPAlertProvider):
# Iterate through source data
for source_alert in http_response.json()["data"]:
# Convert to our alert format
freqs_modes = source_alert.get("mode", "")
if "mhz" in source_alert:
if "mhz_direction" in source_alert:
freqs_modes = f"{source_alert['mhz']!s} {source_alert['mhz_direction']}, {freqs_modes}"
freqs_modes = source_alert.get("mode") or ""
mhz = source_alert.get("mhz")
if mhz is not None:
mhz_direction = source_alert.get("mhz_direction")
if mhz_direction is not None:
freqs_modes = f"{mhz!s} {mhz_direction}, {freqs_modes}"
else:
freqs_modes = f"{source_alert['mhz']!s}, {freqs_modes}"
freqs_modes = f"{mhz!s}, {freqs_modes}"
alert = Alert(
source=self.name,
source_id=source_alert["id"],
dx_calls=[source_alert["callsign"].upper()],
dx_grid=source_alert["grids"][0],
freqs_modes=freqs_modes,
comment=source_alert["comment"],
sig=ActivityName.SATELLITE,
activity=ActivityName.SATELLITE,
# Fudge an activity ref to provide the remaining bits of data we need: the satellite and the operator's grid
sig_refs=[
activity_refs=[
ActivityRef(
sig=ActivityName.SATELLITE,
id=f"{source_alert['satellite']['name']} from {source_alert['grids'][0]}",
activity=ActivityName.SATELLITE,
id=source_alert["satellite"]["name"],
)
],
start_time=datetime.strptime(source_alert["aos_at"], "%Y-%m-%dT%H:%M:%SZ")
+1 -1
View File
@@ -89,7 +89,7 @@ class NG3K(HTTPAlertProvider):
comment=f"{by}; {comment}; {qsl_info}",
start_time=start_timestamp,
end_time=end_timestamp,
sig=ActivityName.DXPEDITION,
activity=ActivityName.DXPEDITION,
)
# Add to our list.
+3 -3
View File
@@ -37,7 +37,7 @@ class ParksNPeaks(HTTPAlertProvider):
datetime.strptime(source_alert["alTime"], "%Y-%m-%d %H:%M:%S").replace(tzinfo=pytz.UTC).timestamp()
)
activity_refs = [ActivityRef(id=ref_id, sig=activity, name=ref_name)]
activity_refs = [ActivityRef(id=ref_id, activity=activity, name=ref_name)]
# Convert to our alert format
alert = Alert(
@@ -46,8 +46,8 @@ class ParksNPeaks(HTTPAlertProvider):
dx_calls=[source_alert["CallSign"].upper()],
freqs_modes=f"{source_alert['Freq']} {source_alert['MODE']}",
comment=source_alert["Comments"],
sig=activity,
sig_refs=activity_refs,
activity=activity,
activity_refs=activity_refs,
start_time=start_time,
)
+3 -3
View File
@@ -28,11 +28,11 @@ class POTA(HTTPAlertProvider):
dx_calls=[source_alert["activator"].upper()],
freqs_modes=source_alert["frequencies"],
comment=source_alert["comments"],
sig=ActivityName.POTA,
sig_refs=[
activity=ActivityName.POTA,
activity_refs=[
ActivityRef(
id=source_alert["reference"],
sig=ActivityName.POTA,
activity=ActivityName.POTA,
name=source_alert["name"],
url=f"https://pota.app/#/park/{source_alert['reference']}",
)
+1 -1
View File
@@ -69,7 +69,7 @@ class RSGBICALAlertProvider(ICALAlertProvider):
comment=summary,
start_time=start_timestamp,
end_time=end_timestamp,
sig=ActivityName.CONTEST,
activity=ActivityName.CONTEST,
)
return alert
+3 -3
View File
@@ -34,11 +34,11 @@ class SOTA(HTTPAlertProvider):
dx_names=[source_alert["activatorName"].upper()],
freqs_modes=source_alert["frequency"],
comment=source_alert["comments"],
sig=ActivityName.SOTA,
sig_refs=[
activity=ActivityName.SOTA,
activity_refs=[
ActivityRef(
id=f"{source_alert['associationCode']}/{source_alert['summitCode']}",
sig=ActivityName.SOTA,
activity=ActivityName.SOTA,
name=summit_name,
activation_score=summit_points,
)
+1 -1
View File
@@ -35,7 +35,7 @@ class WA7BNM(ICALAlertProvider):
url=url,
start_time=start_timestamp,
end_time=end_timestamp,
sig=ActivityName.CONTEST,
activity=ActivityName.CONTEST,
)
return alert
+1 -1
View File
@@ -75,7 +75,7 @@ class WOTA(HTTPAlertProvider):
dx_calls=[dx_call],
freqs_modes=freqs_modes,
comment=comment,
sig_refs=[ActivityRef(id=ref, sig=ActivityName.WOTA, name=ref_name)] if ref else [],
activity_refs=[ActivityRef(id=ref, activity=ActivityName.WOTA, name=ref_name)] if ref else [],
start_time=time.timestamp(),
)
+2 -2
View File
@@ -28,8 +28,8 @@ class WWFF(HTTPAlertProvider):
dx_calls=[source_alert["activator_call"].upper()],
freqs_modes=f"{source_alert['band']} {source_alert['mode']}",
comment=source_alert["remarks"],
sig=ActivityName.WWFF,
sig_refs=[ActivityRef(id=source_alert["reference"], sig=ActivityName.WWFF)],
activity=ActivityName.WWFF,
activity_refs=[ActivityRef(id=source_alert["reference"], activity=ActivityName.WWFF)],
start_time=datetime.strptime(source_alert["utc_start"], "%Y-%m-%d %H:%M:%S")
.replace(tzinfo=pytz.UTC)
.timestamp(),
+4
View File
@@ -1,6 +1,7 @@
import logging
import urllib.parse
from datetime import datetime, timedelta
from xml.parsers.expat import ExpatError
import pytz
import xmltodict
@@ -60,6 +61,9 @@ class HamQTH(APIQueryCallsignDataProvider):
# Log this failure at debug level only, not our problem if user entered the wrong password.
logger.debug("HamQTH login details incorrect, failed to look up with HamQTH.")
return None
except ExpatError:
logger.warning("HamQTH provided blank or malformed content when trying to authenticate")
return None
except Exception:
logger.exception("Exception when getting HamQTH session key")
return None
+4
View File
@@ -1,6 +1,7 @@
import logging
import urllib.parse
from datetime import datetime, timedelta
from xml.parsers.expat import ExpatError
import pytz
import xmltodict
@@ -56,6 +57,9 @@ class QRZ(APIQueryCallsignDataProvider):
# Log this failure at debug level only, not our problem if user entered the wrong password.
logger.debug("QRZ.com login details incorrect, failed to look up with QRZ.")
return None
except ExpatError:
logger.warning("QRZ.com provided blank or malformed content when trying to authenticate")
return None
except Exception:
logger.exception("Exception when getting QRZ.com session key")
return None
+29 -111
View File
@@ -1,20 +1,17 @@
import logging
import re
import socket
from datetime import datetime
from threading import Event, Lock, Thread
import pytz
import telnetlib3
from core.config import SERVER_OWNER_CALLSIGN
from data.spot import Spot
from providers.spot.spot_provider import SpotProvider
from providers.spot.telnet_spot_provider import TelnetSpotProvider
logger = logging.getLogger(__name__)
class DXCluster(SpotProvider):
class DXCluster(TelnetSpotProvider):
"""Spot provider for a DX Cluster. Hostname, port, login_prompt, login_callsign and allow_rbn_spots are provided in config.
See config-example.yml for examples."""
@@ -31,112 +28,33 @@ class DXCluster(SpotProvider):
"""Constructor requires hostname and port"""
name = provider_config.get("name", "Cluster")
super().__init__(name, provider_config)
self._hostname = provider_config["host"]
self._port = provider_config["port"]
self._login_prompt = provider_config.get("login_prompt", "login:")
self._login_callsign = provider_config.get("login_callsign", SERVER_OWNER_CALLSIGN)
self._allow_rbn_spots = provider_config.get("allow_rbn_spots", False)
self._spot_line_pattern = (
self._LINE_PATTERN_ALLOW_RBN if self._allow_rbn_spots else self._LINE_PATTERN_EXCLUDE_RBN
allow_rbn_spots = provider_config.get("allow_rbn_spots", False)
self._spot_line_pattern = self._LINE_PATTERN_ALLOW_RBN if allow_rbn_spots else self._LINE_PATTERN_EXCLUDE_RBN
super().__init__(
name,
provider_config,
host=provider_config["host"],
port=provider_config["port"],
login_prompt=provider_config.get("login_prompt", "login:"),
login_response=provider_config.get("login_callsign", SERVER_OWNER_CALLSIGN),
)
self._telnet = None
self._telnet_lock = Lock()
self._thread = None
self._stop_event = Event()
def start(self):
self._thread = Thread(target=self._handle, name=f"DXClusterSpotProvider-{self.name}", daemon=True)
self._thread.start()
def _parse_line(self, line):
match = self._spot_line_pattern.match(line)
if not match:
return None
def stop(self):
self._stop_event.set()
with self._telnet_lock:
if self._telnet:
try:
self._telnet.sock.shutdown(socket.SHUT_RDWR)
except (AttributeError, OSError):
pass
self._telnet.close()
if self._thread:
self._thread.join(timeout=5)
if self._thread.is_alive():
logger.warning(f"DX Cluster {self._hostname} worker thread did not exit on time and will be killed.")
def _handle(self):
while not self._stop_event.is_set():
connected = False
while not connected and not self._stop_event.is_set():
try:
self.status = "Connecting"
logger.info(f"DX Cluster {self._hostname} connecting...")
new_telnet = telnetlib3.Telnet(self._hostname, self._port)
with self._telnet_lock:
self._telnet = new_telnet
if self._stop_event.is_set():
# stop() was called while we were connecting, close the connection rather than trying to
# read when we know it won't work
new_telnet.close()
break
self._telnet.read_until(self._login_prompt.encode("latin-1"))
self._telnet.write(f"{self._login_callsign}\n".encode("latin-1"))
connected = True
logger.info(f"DX Cluster {self._hostname} connected.")
except ConnectionRefusedError:
self.status = "Error"
logger.warning(f"Connection refused to DX cluster {self._hostname}")
self._stop_event.wait(timeout=300)
except Exception:
self.status = "Error"
logger.exception(f"Exception while connecting to DX Cluster Provider ({self._hostname}).")
self._stop_event.wait(timeout=5)
self.status = "Waiting for Data"
while connected and not self._stop_event.is_set():
try:
# Check new telnet info against regular expression
telnet_output = self._telnet.read_until("\n".encode("latin-1"))
match = self._spot_line_pattern.match(telnet_output.decode("latin-1"))
if match:
spot_time = datetime.strptime(match.group(5), "%H%MZ").replace(tzinfo=pytz.UTC)
spot_datetime = datetime.combine(
datetime.now(pytz.UTC).date(),
spot_time.time(),
tzinfo=pytz.UTC,
)
spot = Spot(
source=self.name,
dx_call=match.group(3),
de_call=match.group(1),
freq=float(match.group(2)) * 1000,
comment=match.group(4).strip(),
time=spot_datetime.timestamp(),
)
# Add to our list
self._submit(spot)
self.status = "OK"
self.last_update_time = datetime.now(pytz.UTC)
logger.debug(f"Data received from DX Cluster {self._hostname}.")
except EOFError:
connected = False
if not self._stop_event.is_set():
self.status = "Restarting"
logger.warning(f"Disconnected from DX Cluster {self._hostname}. Reconnecting...")
self._stop_event.wait(timeout=5)
else:
logger.info(f"DX Cluster {self._hostname} shutting down...")
self.status = "Shutting down"
except Exception:
connected = False
if not self._stop_event.is_set():
self.status = "Error"
logger.exception(f"Exception in DX Cluster Provider ({self._hostname})")
self._stop_event.wait(timeout=5)
else:
logger.info(f"DX Cluster {self._hostname} shutting down...")
self.status = "Shutting down"
self.status = "Disconnected"
spot_time = datetime.strptime(match.group(5), "%H%MZ").replace(tzinfo=pytz.UTC)
spot_datetime = datetime.combine(
datetime.now(pytz.UTC).date(),
spot_time.time(),
tzinfo=pytz.UTC,
)
return Spot(
source=self.name,
dx_call=match.group(3),
de_call=match.group(1),
freq=float(match.group(2)) * 1000,
comment=match.group(4).strip(),
time=spot_datetime.timestamp(),
)
+41 -38
View File
@@ -68,10 +68,10 @@ class GMA(HTTPSpotProvider):
# Filter out some weird mode strings
mode=Mode.from_name(source_spot["MODE"].upper()) if "<>" not in source_spot["MODE"] else None,
comment=source_spot["TEXT"],
sig_refs=[
activity_refs=[
ActivityRef(
id=source_spot["REF"],
sig="",
activity="",
name=source_spot["NAME"],
latitude=lat,
longitude=lon,
@@ -98,54 +98,57 @@ 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.activity_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.activity_refs[0].activity = ActivityName.SOTA
spot.activity_refs[0].ref_type = ActivityRefType.SUMMIT
spot.activity = ActivityName.SOTA
else:
spot.activity_refs[0].activity = ActivityName.GMA
spot.activity_refs[0].ref_type = ActivityRefType.SUMMIT
spot.activity = ActivityName.GMA
case "POTA":
spot.activity_refs[0].activity = ActivityName.POTA
spot.activity_refs[0].ref_type = ActivityRefType.PARK
spot.activity = ActivityName.POTA
case "WWFF":
spot.activity_refs[0].activity = ActivityName.WWFF
spot.activity_refs[0].ref_type = ActivityRefType.PARK
spot.activity = ActivityName.WWFF
case "IOTA Island":
spot.sig_refs[0].sig = ActivityName.IOTA
spot.sig_refs[0].ref_type = ActivityRefType.ISLAND
spot.sig = ActivityName.IOTA
spot.activity_refs[0].activity = ActivityName.IOTA
spot.activity_refs[0].ref_type = ActivityRefType.ISLAND
spot.activity = ActivityName.IOTA
case "GMA Island":
spot.sig_refs[0].sig = ActivityName.GMA_ISLANDS
spot.sig_refs[0].ref_type = ActivityRefType.ISLAND
spot.sig = ActivityName.GMA_ISLANDS
spot.activity_refs[0].activity = ActivityName.GMA_ISLANDS
spot.activity_refs[0].ref_type = ActivityRefType.ISLAND
spot.activity = ActivityName.GMA_ISLANDS
case "Lighthouse (ILLW)":
spot.sig_refs[0].sig = ActivityName.ILLW
spot.sig_refs[0].ref_type = ActivityRefType.LIGHTHOUSE
spot.sig = ActivityName.ILLW
spot.activity_refs[0].activity = ActivityName.ILLW
spot.activity_refs[0].ref_type = ActivityRefType.LIGHTHOUSE
spot.activity = ActivityName.ILLW
case "Lighthouse (ARLHS)":
spot.sig_refs[0].sig = ActivityName.ARLHS
spot.sig_refs[0].ref_type = ActivityRefType.LIGHTHOUSE
spot.sig = ActivityName.ARLHS
spot.activity_refs[0].activity = ActivityName.ARLHS
spot.activity_refs[0].ref_type = ActivityRefType.LIGHTHOUSE
spot.activity = ActivityName.ARLHS
case "Castle":
spot.sig_refs[0].sig = ActivityName.WCA
spot.sig_refs[0].ref_type = ActivityRefType.CASTLE
spot.sig = ActivityName.WCA
spot.activity_refs[0].activity = ActivityName.WCA
spot.activity_refs[0].ref_type = ActivityRefType.CASTLE
spot.activity = ActivityName.WCA
case "Mill":
spot.sig_refs[0].sig = ActivityName.MOTA
spot.sig_refs[0].ref_type = ActivityRefType.MILL
spot.sig = ActivityName.MOTA
spot.activity_refs[0].activity = ActivityName.MOTA
spot.activity_refs[0].ref_type = ActivityRefType.MILL
spot.activity = ActivityName.MOTA
case _:
logger.warning(
f"GMA spot found with ref type {ref_info['reftype']}, developer needs to add support for this!"
)
spot.sig_refs[0].sig = ref_info["reftype"]
spot.sig = ref_info["reftype"]
spot.activity_refs[0].activity = ref_info["reftype"]
spot.activity = ref_info["reftype"]
elif not ref_response.from_cache:
if not ref_response.ok:
+3 -3
View File
@@ -62,11 +62,11 @@ class HEMA(HTTPSpotProvider):
freq=float(freq_mode_match.group(1)) * 1000000,
mode=Mode.from_name(freq_mode_match.group(2).upper()),
comment=spotter_comment_match.group(2),
sig=ActivityName.HEMA,
sig_refs=[
activity=ActivityName.HEMA,
activity_refs=[
ActivityRef(
id=spot_items[3].upper(),
sig=ActivityName.HEMA,
activity=ActivityName.HEMA,
name=spot_items[4],
latitude=float(spot_items[7]),
longitude=float(spot_items[8]),
+3 -3
View File
@@ -34,11 +34,11 @@ class LLOTA(HTTPSpotProvider):
freq=float(source_spot["frequency"]) * 1000000,
mode=Mode.from_name(source_spot["mode"].upper()),
comment=comment,
sig=ActivityName.LLOTA,
sig_refs=[
activity=ActivityName.LLOTA,
activity_refs=[
ActivityRef(
id=source_spot["reference"],
sig=ActivityName.LLOTA,
activity=ActivityName.LLOTA,
name=source_spot["reference_name"],
ref_type=ActivityRefType.LAKE,
)
+26 -11
View File
@@ -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 = []
spot.activity = activity
if ref_id:
activity_refs = [
ActivityRef(
id=source_spot["actSiteID"],
sig=activity,
id=ref_id,
activity=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
spot.activity_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)
@@ -113,9 +128,9 @@ class ParksNPeaks(HTTPSpotProvider):
raise ValueError(
"Parks N Peaks user ID and API key are required. Get yours from your Parks N Peaks account."
)
ref_id = spot.sig_refs[0].id if spot.sig_refs else ""
ref_id = spot.activity_refs[0].id if spot.activity_refs else ""
body = {
"actClass": spot.sig or "",
"actClass": spot.activity or "",
"actCallsign": spot.dx_call,
"actSite": ref_id,
"mode": spot.mode or "",
+6 -6
View File
@@ -33,11 +33,11 @@ class POTA(HTTPSpotProvider):
freq=float(source_spot["frequency"]) * 1000 if source_spot["frequency"] != "INVALID" else None,
mode=Mode.from_name(source_spot["mode"].upper()),
comment=source_spot["comments"],
sig=ActivityName.POTA,
sig_refs=[
activity=ActivityName.POTA,
activity_refs=[
ActivityRef(
id=source_spot["reference"],
sig=ActivityName.POTA,
activity=ActivityName.POTA,
name=source_spot["name"],
latitude=source_spot["latitude"],
longitude=source_spot["longitude"],
@@ -61,14 +61,14 @@ class POTA(HTTPSpotProvider):
return activity == ActivityName.POTA
def submit_spot(self, spot, credentials):
sig_ref = spot.sig_refs[0].id if spot.sig_refs else None
if sig_ref:
ref_id = spot.activity_refs[0].id if spot.activity_refs else None
if ref_id:
body = {
"activator": spot.dx_call,
"spotter": spot.de_call,
"frequency": str(spot.freq / 1000.0),
"mode": spot.mode or "",
"reference": sig_ref,
"reference": ref_id,
"comments": spot.comment or "",
"source": "Spothole",
}
+29 -102
View File
@@ -1,22 +1,19 @@
import logging
import re
import socket
from datetime import datetime
from threading import Event, Lock, Thread
import pytz
import telnetlib3
from core.config import SERVER_OWNER_CALLSIGN
from data.spot import Spot
from providers.spot.spot_provider import SpotProvider
from providers.spot.telnet_spot_provider import TelnetSpotProvider
logger = logging.getLogger(__name__)
class RBN(SpotProvider):
class RBN(TelnetSpotProvider):
"""Spot provider for the Reverse Beacon Network. Connects to a single port, if you want both CW/RTTY (port 7000) and FT8
(port 7001) you need to instantiate two copies of this. The port is provided as an argument to the constructor."""
(port 7001) you need to instantiate two copies of this. The port is provided in config."""
_LINE_PATTERN = re.compile(
r"^DX de ([a-z0-9/]+)-.*:\s+([0-9.]+)\s+([a-z0-9/]+)\s+(.*)\s+(\d{4}Z)",
@@ -27,101 +24,31 @@ class RBN(SpotProvider):
"""Constructor requires port number."""
name = provider_config.get("name", "RBN")
super().__init__(name, provider_config)
self._port = provider_config["port"]
self._telnet = None
self._telnet_lock = Lock()
self._thread = None
self._stop_event = Event()
super().__init__(
name,
provider_config,
host="telnet.reversebeacon.net",
port=provider_config["port"],
login_prompt="Please enter your call: ",
login_response=SERVER_OWNER_CALLSIGN,
)
def start(self):
self._thread = Thread(target=self._handle, name=f"RBNSpotProvider-{self.name}", daemon=True)
self._thread.start()
def _parse_line(self, line):
match = self._LINE_PATTERN.match(line)
if not match:
return None
def stop(self):
self._stop_event.set()
with self._telnet_lock:
if self._telnet:
try:
self._telnet.sock.shutdown(socket.SHUT_RDWR)
except (AttributeError, OSError):
pass
self._telnet.close()
if self._thread:
self._thread.join(timeout=5)
if self._thread.is_alive():
logger.warning(f"RBN (port {self._port!s}) worker thread did not exit on time and will be killed.")
def _handle(self):
while not self._stop_event.is_set():
connected = False
while not connected and not self._stop_event.is_set():
try:
self.status = "Connecting"
logger.info(f"RBN port {self._port!s} connecting...")
new_telnet = telnetlib3.Telnet("telnet.reversebeacon.net", self._port)
with self._telnet_lock:
self._telnet = new_telnet
if self._stop_event.is_set():
# stop() was called while we were connecting, close the connection rather than trying to
# read when we know it won't work
new_telnet.close()
break
self._telnet.read_until("Please enter your call: ".encode("latin-1"))
self._telnet.write(f"{SERVER_OWNER_CALLSIGN}\n".encode("latin-1"))
connected = True
logger.info(f"RBN port {self._port!s} connected.")
except Exception:
self.status = "Error"
logger.exception(f"Exception while connecting to RBN (port {self._port!s}).")
self._stop_event.wait(timeout=5)
self.status = "Waiting for Data"
while connected and not self._stop_event.is_set():
try:
# Check new telnet info against regular expression
telnet_output = self._telnet.read_until("\n".encode("latin-1"))
match = self._LINE_PATTERN.match(telnet_output.decode("latin-1"))
if match:
spot_time = datetime.strptime(match.group(5), "%H%MZ").replace(tzinfo=pytz.UTC)
spot_datetime = datetime.combine(
datetime.now(pytz.UTC).date(),
spot_time.time(),
tzinfo=pytz.UTC,
)
spot = Spot(
source=self.name,
dx_call=match.group(3),
de_call=match.group(1),
freq=float(match.group(2)) * 1000,
comment=match.group(4).strip(),
time=spot_datetime.timestamp(),
)
# Add to our list
self._submit(spot)
self.status = "OK"
self.last_update_time = datetime.now(pytz.UTC)
logger.debug(f"Data received from RBN on port {self._port!s}.")
except EOFError:
connected = False
if not self._stop_event.is_set():
self.status = "Restarting"
logger.warning(f"Disconnected from RBN provider (port {self._port!s}). Reconnecting...")
self._stop_event.wait(timeout=5)
else:
logger.info(f"RBN provider (port {self._port!s}) shutting down...")
self.status = "Shutting down"
except Exception:
connected = False
if not self._stop_event.is_set():
self.status = "Error"
logger.exception(f"Exception in RBN provider (port {self._port!s})")
self._stop_event.wait(timeout=5)
else:
logger.info(f"RBN provider (port {self._port!s}) shutting down...")
self.status = "Shutting down"
self.status = "Disconnected"
spot_time = datetime.strptime(match.group(5), "%H%MZ").replace(tzinfo=pytz.UTC)
spot_datetime = datetime.combine(
datetime.now(pytz.UTC).date(),
spot_time.time(),
tzinfo=pytz.UTC,
)
return Spot(
source=self.name,
dx_call=match.group(3),
de_call=match.group(1),
freq=float(match.group(2)) * 1000,
comment=match.group(4).strip(),
time=spot_datetime.timestamp(),
)
+6 -6
View File
@@ -57,11 +57,11 @@ class SOTA(HTTPSpotProvider):
# Seen SOTA spots with no frequency!
mode=Mode.from_name(source_spot["mode"].upper()),
comment=source_spot["comments"],
sig=ActivityName.SOTA,
sig_refs=[
activity=ActivityName.SOTA,
activity_refs=[
ActivityRef(
id=source_spot["summitCode"],
sig=ActivityName.SOTA,
activity=ActivityName.SOTA,
name=source_spot["summitName"],
latitude=source_spot["latitude"],
longitude=source_spot["longitude"],
@@ -92,10 +92,10 @@ class SOTA(HTTPSpotProvider):
id_token = credentials.get("id_token", "")
if not access_token or not id_token:
raise ValueError("SOTA API tokens are required. Please log into SOTA in order to spot to it.")
sig_ref = spot.sig_refs[0].id if spot.sig_refs else ""
if sig_ref:
ref_id = spot.activity_refs[0].id if spot.activity_refs else ""
if ref_id:
# Split reference into association and summit codes
ref_split = sig_ref.split("/")
ref_split = ref_id.split("/")
# Figure out a valid mode. Borrowed this from PoLo :)
# https://github.com/ham2k/app-polo/blob/main/src/extensions/activities/sota/SOTAPostSelfSpot.js
+117
View File
@@ -0,0 +1,117 @@
import logging
import socket
from datetime import datetime
from threading import Event, Lock, Thread
import pytz
import telnetlib3
from core.utils import decode_telnet_bytes
from providers.spot.spot_provider import SpotProvider
logger = logging.getLogger(__name__)
class TelnetSpotProvider(SpotProvider):
"""Base class for spot providers that connect to a telnet server to receive spots."""
def __init__(self, name, provider_config, host, port, login_prompt, login_response):
"""Constructor. host/port are the telnet server to connect to. login_prompt is the text to wait for before
logging in, and login_response is the callsign to send in response."""
super().__init__(name, provider_config)
self._host = host
self._port = port
self._login_prompt = login_prompt
self._login_response = login_response
self._telnet = None
self._telnet_lock = Lock()
self._thread = None
self._stop_event = Event()
def _parse_line(self, line):
"""Parse a line of telnet output and return a Spot, or None if the line did not contain a spot. Subclasses
must implement this method."""
raise NotImplementedError("Subclasses must implement this method")
def start(self):
self._thread = Thread(target=self._handle, name=f"{self.name}SpotProvider", daemon=True)
self._thread.start()
def stop(self):
self._stop_event.set()
with self._telnet_lock:
if self._telnet:
try:
self._telnet.sock.shutdown(socket.SHUT_RDWR)
except (AttributeError, OSError):
pass
self._telnet.close()
if self._thread:
self._thread.join(timeout=5)
if self._thread.is_alive():
logger.warning(f"{self.name} worker thread did not exit on time and will be killed.")
def _handle(self):
while not self._stop_event.is_set():
connected = False
while not connected and not self._stop_event.is_set():
try:
self.status = "Connecting"
logger.info(f"{self.name} connecting to {self._host}:{self._port!s}...")
new_telnet = telnetlib3.Telnet(self._host, self._port)
with self._telnet_lock:
self._telnet = new_telnet
if self._stop_event.is_set():
# stop() was called while we were connecting, close the connection rather than trying to
# read when we know it won't work
new_telnet.close()
break
self._telnet.read_until(self._login_prompt.encode("latin-1"))
self._telnet.write(f"{self._login_response}\n".encode("latin-1"))
connected = True
logger.info(f"{self.name} connected.")
except ConnectionRefusedError:
self.status = "Error"
logger.warning(f"Connection refused to {self.name} ({self._host}:{self._port!s}).")
self._stop_event.wait(timeout=300)
except Exception:
self.status = "Error"
logger.exception(f"Exception while connecting to {self.name} ({self._host}:{self._port!s}).")
self._stop_event.wait(timeout=5)
self.status = "Waiting for Data"
while connected and not self._stop_event.is_set():
try:
# Check new telnet info against regular expression
telnet_output = self._telnet.read_until("\n".encode("latin-1"))
spot = self._parse_line(decode_telnet_bytes(telnet_output))
if spot:
# Add to our list
self._submit(spot)
self.status = "OK"
self.last_update_time = datetime.now(pytz.UTC)
logger.debug(f"Data received from {self.name}.")
except EOFError:
connected = False
if not self._stop_event.is_set():
self.status = "Restarting"
logger.warning(f"Disconnected from {self.name}. Reconnecting...")
self._stop_event.wait(timeout=5)
else:
logger.info(f"{self.name} shutting down...")
self.status = "Shutting down"
except Exception:
connected = False
if not self._stop_event.is_set():
self.status = "Error"
logger.exception(f"Exception in {self.name}")
self._stop_event.wait(timeout=5)
else:
logger.info(f"{self.name} shutting down...")
self.status = "Shutting down"
self.status = "Disconnected"
+3 -3
View File
@@ -59,13 +59,13 @@ class Tiles(HTTPSpotProvider):
freq=freq,
mode=Mode.from_name(source_spot["mode"].upper()),
comment=source_spot["notes"],
sig=ActivityName.TILES,
activity=ActivityName.TILES,
# Tiles spots can include POTA & SOTA references, but ignore those on the basis that we will get them separately from the POTA/SOTA providers anyway.
# Just take the grid reference itself as the single Tiles activity reference.
sig_refs=[
activity_refs=[
ActivityRef(
id=source_spot["maidenhead_grid"],
sig=ActivityName.TILES,
activity=ActivityName.TILES,
name=source_spot["maidenhead_grid"],
latitude=source_spot["latitude"],
longitude=source_spot["longitude"],
+4 -2
View File
@@ -34,8 +34,10 @@ class Towers(HTTPSpotProvider):
dx_call=source_spot["call"].upper(),
freq=likely_freq,
comment=source_spot["comment"],
sig=ActivityName.TOWERS,
sig_refs=[ActivityRef(id=source_spot["ref"], sig=ActivityName.TOWERS, ref_type=ActivityRefType.TOWER)],
activity=ActivityName.TOWERS,
activity_refs=[
ActivityRef(id=source_spot["ref"], activity=ActivityName.TOWERS, ref_type=ActivityRefType.TOWER)
],
time=datetime.strptime(response_json["updated"][:10] + source_spot["time"], "%Y-%m-%d%H:%M")
.replace(tzinfo=pytz.utc)
.timestamp(),
+7 -3
View File
@@ -92,9 +92,13 @@ class WOTA(HTTPSpotProvider):
freq=freq_hz,
mode=Mode.from_name(mode),
comment=comment,
sig=ActivityName.WOTA,
sig_refs=(
[ActivityRef(id=ref, sig=ActivityName.WOTA, name=ref_name, ref_type=ActivityRefType.SUMMIT)]
activity=ActivityName.WOTA,
activity_refs=(
[
ActivityRef(
id=ref, activity=ActivityName.WOTA, name=ref_name, ref_type=ActivityRefType.SUMMIT
)
]
if ref
else []
),
+3 -3
View File
@@ -23,7 +23,7 @@ class WWBOTA(SSESpotProvider):
for ref in source_spot["references"]:
activity_ref = ActivityRef(
id=ref["reference"],
sig=ActivityName.WWBOTA,
activity=ActivityName.WWBOTA,
name=ref["name"],
latitude=ref["lat"],
longitude=ref["long"],
@@ -38,8 +38,8 @@ class WWBOTA(SSESpotProvider):
freq=float(source_spot["freq"]) * 1000000,
mode=Mode.from_name(source_spot["mode"].upper()) if source_spot.get("mode") else None,
comment=source_spot["comment"],
sig=ActivityName.WWBOTA,
sig_refs=refs,
activity=ActivityName.WWBOTA,
activity_refs=refs,
time=datetime.fromisoformat(source_spot["time"].replace("Z", "+00:00")).timestamp(),
# 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.
+3 -3
View File
@@ -30,11 +30,11 @@ class WWFF(HTTPSpotProvider):
freq=float(source_spot["frequency_khz"]) * 1000,
mode=Mode.from_name(source_spot["mode"].upper()),
comment=source_spot["remarks"],
sig=ActivityName.WWFF,
sig_refs=[
activity=ActivityName.WWFF,
activity_refs=[
ActivityRef(
id=source_spot["reference"],
sig=ActivityName.WWFF,
activity=ActivityName.WWFF,
name=source_spot["reference_name"],
latitude=source_spot["latitude"],
longitude=source_spot["longitude"],
+9 -7
View File
@@ -14,16 +14,18 @@ class XOTA(WebsocketSpotProvider):
The provider typically doesn't give us a lat/lon or activity explicitly, so our own config provides an activity
which we can then use for lookups. This functionality is implemented for Toilets on the Air events, of which
there are several - so a plain lookup of a "TOTA reference" doesn't make sense, it depends on which TOTA, which
is why we also provide a sig_ref_prefix in our config. This is applied to the reference ID, so e.g. "T-01" at C3
might become "C3 T-01". This allows us to provide location lookups for TOTA at several conferences."""
is why we also provide an activity_ref_prefix in our config. This is applied to the reference ID, so e.g. "T-01"
at C3 might become "C3 T-01". This allows us to provide location lookups for TOTA at several conferences."""
ACTIVITY = None
def __init__(self, provider_config):
name = provider_config.get("name", "xOTA")
super().__init__(name, provider_config, provider_config["url"])
self.ACTIVITY = str(provider_config["sig"]) if "sig" in provider_config else None
self._activity_ref_prefix = str(provider_config["sig_ref_prefix"]) if "sig_ref_prefix" in provider_config else ""
self.ACTIVITY = str(provider_config["activity"]) if "activity" in provider_config else None
self._activity_ref_prefix = (
str(provider_config["activity_ref_prefix"]) if "activity_ref_prefix" in provider_config else ""
)
def _ws_message_to_spot(self, b):
string = b.decode("utf-8")
@@ -35,11 +37,11 @@ class XOTA(WebsocketSpotProvider):
dx_call=source_spot["stationCallSign"].upper(),
freq=float(source_spot["freq"]) * 1000,
mode=Mode.from_name(source_spot["mode"].upper()),
sig=self.ACTIVITY,
sig_refs=[
activity=self.ACTIVITY,
activity_refs=[
ActivityRef(
id=ref_id,
sig=self.ACTIVITY or "",
activity=self.ACTIVITY or "",
url=source_spot["reference"]["website"],
)
],
+3 -3
View File
@@ -35,11 +35,11 @@ class ZLOTA(HTTPSpotProvider):
freq=freq_hz,
mode=Mode.from_name(source_spot["mode"].upper().strip()),
comment=source_spot["comments"],
sig=ActivityName.ZLOTA,
sig_refs=[
activity=ActivityName.ZLOTA,
activity_refs=[
ActivityRef(
id=source_spot["reference"],
sig=ActivityName.ZLOTA,
activity=ActivityName.ZLOTA,
name=source_spot["name"],
)
],
+1 -1
View File
@@ -1,6 +1,6 @@
[project]
name = "spothole"
version = "2.2-pre"
version = "3.0-pre"
authors = [
{ name = "Ian Renton", email = "ian@ianrenton.com" },
]
+90 -56
View File
@@ -3,24 +3,44 @@ openapi: 3.1.0
info:
title: Spothole API
description: |-
Spothole is a utility to aggregate "spots" from amateur radio DX clusters and xOTA spotting sites, and provide an open JSON API as well as a website to browse the data.
Spothole is a utility to aggregate "spots" from amateur radio DX clusters and xOTA spotting sites, and provide an open JSON API as well as a website to browse the data. This page is an OpenAPI specification which describes Spothole's API. Clients can use this API to retrieve all the spots, alerts, and other information known to Spothole.
While there are other web-based interfaces to DX clusters, and sites that aggregate spots from various outdoor activity programmes for amateur radio, Spothole differentiates itself by supporting a large number of data sources, and by being "API first" rather than just providing a web front-end. This allows other software to be built on top of it. Spothole itself is also open source, Public Domain licenced code that anyone can take and modify.
You can find out more information about Spothole at https://spothole.app/help, and specifically about creating a client to this API at https://spothole.app/help/usage/clients.
The API calls described below allow third-party software to access data from Spothole, and receive data on spots and alerts in a consistent format regardless of the data sources used by Spothole itself. Utility calls are also provided for general data lookups.
Please note that the data coming out of Spothole is only as good as the data going in. People mis-hear and make typos when spotting callsigns all the time, and there are plenty of areas where Spothole's location data may be inaccurate. If you are doing something where accuracy is important, such as contesting, you should not rely on Spothole's data to fill in any gaps in your log.
Spothole's source code is located at https://git.ianrenton.com/ian/spothole and the README there provides setup instructions if you would like to run your own copy. A demonstration server of Spothole is located at https://spothole.app. The README also contains some examples of how you could query the API of the demonstration server to integrate the data into your own apps.
The API provided by https://spothole.app is provided free of charge, and no authentication is required. By using it, you accept the following:
* You wrote the client code yourself, OR, if you got an AI to write it for you, you promise to read and understand what it wrote before contacting me about any problems.
* You set a sensible refresh rate and will not try to take down the server by bombarding it with tons of requests.
* There is no uptime guarantee. This is a hobby project and sometimes I will accidentally break stuff.
* Trans rights are human rights.
## Changelog
### 3.0
The term "SIG" (Special Interest Group), which Spothole inherited from ADIF, has been replaced with "activity" throughout the API.
* **Breaking change:** In spot and alert data, `sig` has been renamed to `activity` and `sig_refs` to `activity_refs`.
* **Breaking change:** In activity reference data (i.e. each entry in `activity_refs`, and the response of the activity reference lookup), `sig` has been renamed to `activity`.
* **Breaking change:** The `dx_location_source` value "SIG REF LOOKUP" has been renamed to "ACTIVITY REF LOOKUP".
* **Breaking change:** The `/spots`, `/spots/stream`, `/alerts` and `/alerts/stream` query parameter `sig` has been renamed to `activity`, and its special value `NO_SIG` to `NO_ACTIVITY`. The `/spots` and `/spots/stream` query parameters `needs_sig` and `needs_sig_ref` have been renamed to `needs_activity` and `needs_activity_ref`. When using the `fields` query parameter, use the new field names `activity` and `activity_refs`.
* **Breaking change:** `/lookup/sigref` has been renamed to `/lookup/activityref`, and its `sig` query parameter has been renamed to `activity`.
* **Breaking change:** POST `/spot` now expects `activity` and `activity_refs` in the `spot` object, rather than `sig` and `sig_refs`.
* **Breaking change:** In the `/options` response, `sigs` has been renamed to `activities`, and within each activity, `sig_type` has been renamed to `activity_type`.
* **Breaking change:** In the `/status` response, `sig_ref_data_providers` has been renamed to `activity_ref_data_providers`, and within each provider, `sig_name` has been renamed to `activity_name`.
#### Upgrading a client from v2 to v3 API endpoints
In v3.0 of Spothole, the `v2` (and `v1`) API endpoints will be maintained for backwards compatibility, so if you have written a client against the `v2` API, it will continue to receive `sig`, `sig_refs` etc. as before. However, you are encouraged to move to the `v3` API endpoints as soon as possible.
To upgrade, replace `v2` with `v3` in the URLs your code calls, then rename any use of the fields, query parameters and values listed above. If you use the activity reference lookup, call `/lookup/activityref?activity=...&id=...` instead of `/lookup/sigref?sig=...&id=...`.
### 2.2
* Renamed AMSAT SIG to "Satellite" as AMSAT is a specific organisation not just a general term for satellite QSOs
* Removed `alert_type` from alert data. Contest, DXpedition and Satellite alerts now give those values in `sig` instead, alongside the existing outdoor activity programmes. Teeeeechnically a breaking change but AlertType is so new I doubt anyone is using it yet, so slipped this one in anyway. Sorry :)
* Added QRP, RaDAR Rally, /AM and /MM activities
* Added `has_refs` and `alerts_possible` to Activity data
* Added `dx_grid`, `dx_latitude` and `dx_longitude` to alert data
### 2.1
@@ -101,10 +121,10 @@ info:
license:
name: The Unlicense
url: https://unlicense.org/#the-unlicense
version: 2.0
version: 3.0
servers:
- url: https://spothole.app/api/v2
- url: https://spothole.app/api/v3
tags:
- name: Spots
@@ -395,7 +415,7 @@ paths:
example: "Failed"
/lookup/sigref:
/lookup/activityref:
get:
tags:
- Utilities
@@ -404,7 +424,7 @@ paths:
Perform a lookup of data about a certain reference, providing the activity and the ID of the
reference. An ActivityRef structure will be returned containing the activity and ID, plus any other
information Spothole could find about it.
operationId: sigref
operationId: activityref
parameters:
- $ref: '#/components/parameters/ActivityRefLookupActivity'
- $ref: '#/components/parameters/ActivityRefLookupId'
@@ -460,7 +480,7 @@ paths:
Supply a JSON object containing a `spot` sub-object (the spot data) and an optional `handling` sub-object
containing server-side instructions such as upstream submission). Check `spot_submit_providers` in the
`/options` response to see which activities and providers support upstream submission. cURL example:
`curl --request POST --header \"Content-Type: application/json\" --data '{\"spot\":{\"dx_call\":\"M0TRT\",\"time\":1760019539,\"freq\":14200000,\"comment\":\"Test spot please ignore\",\"de_call\":\"M0TRT\"}}' https://spothole.app/api/v2/spot`"
`curl --request POST --header \"Content-Type: application/json\" --data '{\"spot\":{\"dx_call\":\"M0TRT\",\"time\":1760019539,\"freq\":14200000,\"comment\":\"Test spot please ignore\",\"de_call\":\"M0TRT\"}}' https://spothole.app/api/v3/spot`"
operationId: spot
requestBody:
description: Object containing a "spot" sub-object with the spot data, and an optional "handling" sub-object with server-side instructions of what to do with it.
@@ -558,32 +578,32 @@ components:
schema:
$ref: "#/components/schemas/Source"
SpotActivity:
name: sig
name: activity
in: query
description: >
Limit the spots to only ones from one or more activities provided as an argument.
To select more than one activity, supply a comma-separated list. The special `sig` name `NO_SIG`
matches spots with no activity set. You can use `sig=NO_SIG` to specifically only return generic
To select more than one activity, supply a comma-separated list. The special `activity` name `NO_ACTIVITY`
matches spots with no activity set. You can use `activity=NO_ACTIVITY` to specifically only return generic
spots with no associated activity. You can also use combinations to request for example POTA + no
activity, but reject other activities. If you want to request 'every activity and not No Activity', see the
`needs_sig` query parameter for a shortcut.
`needs_activity` query parameter for a shortcut.
schema:
$ref: "#/components/schemas/ActivityNameIncludingNoSig"
$ref: "#/components/schemas/ActivityNameIncludingNoActivity"
SpotNeedsActivity:
name: needs_sig
name: needs_activity
in: query
description: >
Limit the spots to only ones with an activity such as POTA. Because supplying all
known activities as a `sigs` parameter is unwieldy, and leaving `sigs` blank will also return spots
known activities as an `activity` parameter is unwieldy, and leaving `activity` blank will also return spots
with *no* activity, this parameter can be set true to return only spots with an activity, regardless of
what it is, so long as it's not blank. This is the equivalent of supplying the `sig` query
param with a list of every known activity apart from the special `NO_SIG` value. This is what Field
what it is, so long as it's not blank. This is the equivalent of supplying the `activity` query
param with a list of every known activity apart from the special `NO_ACTIVITY` value. This is what Field
Spotter uses to exclude generic cluster spots and only retrieve xOTA things.
schema:
type: boolean
default: false
SpotNeedsActivityRef:
name: needs_sig_ref
name: needs_activity_ref
in: query
description: >
Limit the spots to only ones which have at least one reference (e.g. a park reference) for
@@ -722,14 +742,14 @@ components:
schema:
$ref: "#/components/schemas/Source"
AlertActivity:
name: sig
name: activity
in: query
description: >
Limit the alerts to only ones from one or more activities. To select more than one
activity, supply a comma-separated list. The special value 'NO_SIG' can be included to return alerts
specifically without an associated activity (i.e. general DXpeditions).
activity, supply a comma-separated list. The special value 'NO_ACTIVITY' can be included to return alerts
specifically without an associated activity.
schema:
$ref: "#/components/schemas/ActivityNameIncludingNoSig"
$ref: "#/components/schemas/ActivityNameIncludingNoActivity"
AlertDxContinent:
name: dx_continent
in: query
@@ -838,9 +858,9 @@ components:
type: string
example: M0TRT
ActivityRefLookupActivity:
name: sig
name: activity
in: query
description: Activity, e.g. outdoor activity programme such as POTA (still named "sig" in the API for backwards compatibility)
description: Activity, e.g. outdoor activity programme such as POTA
required: true
schema:
$ref: "#/components/schemas/ActivityName"
@@ -937,11 +957,11 @@ components:
- EVENT
example: TRADITIONAL
ActivityNameIncludingNoSig:
ActivityNameIncludingNoActivity:
oneOf:
- $ref: "#/components/schemas/ActivityName"
- type: string
enum: [ NO_SIG ]
enum: [ NO_ACTIVITY ]
example: POTA
ActivityRefType:
@@ -1067,7 +1087,7 @@ components:
type: string
enum:
- SPOT
- "SIG REF LOOKUP"
- "ACTIVITY REF LOOKUP"
- "GRID"
- "HOME QTH"
- DXCC
@@ -1089,8 +1109,8 @@ components:
type: string
description: Activity reference ID.
example: GB-0001
sig:
description: Activity that this reference is in. Still named "sig" in the API for backwards compatibility.
activity:
description: Activity that this reference is in.
$ref: "#/components/schemas/ActivityName"
name:
type: string
@@ -1204,7 +1224,7 @@ components:
itself, or from a lookup of the activity ref (e.g. park) 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. "SPOT" indicates the location source was the spot itself from the
spotting service. "SIG REF LOOKUP" indicates that the spot didn't provide a location,
spotting service. "ACTIVITY REF LOOKUP" indicates that the spot didn't provide a location,
but we looked it up from reference data. "GRID" indicates that the spot provided some
location data such as a Maidenhead, UK Ordnance Survey or Irish grid reference, but the
location is likely less accurate than "SPOT". "HOME QTH" indicates we looked up the DX
@@ -1217,7 +1237,7 @@ components:
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", "SIG REF LOOKUP" or "GRID", or alternatively if
true if the source is "SPOT", "ACTIVITY REF LOOKUP" or "GRID", or alternatively if
the source is "HOME QTH" and the callsign doesn't have a slash in it (i.e. operator
likely at home).
example: true
@@ -1314,14 +1334,14 @@ components:
type: string
description: Comment left by the spotter, if any
example: "59 in NY 73"
sig:
description: Activity, e.g. outdoor activity programme such as POTA (still named "sig" in the API for backwards compatibility)
activity:
description: Activity, e.g. outdoor activity programme such as POTA
$ref: "#/components/schemas/ActivityName"
sig_refs:
activity_refs:
type: array
items:
$ref: '#/components/schemas/ActivityRef'
description: Activity references. We allow multiple here for e.g. n-fer activations, unlike ADIF SIG_INFO. Still named "sig_refs" in the API for backwards compatibility.
description: Activity references. We allow multiple here for e.g. n-fer activations, unlike ADIF SIG_INFO.
qrt:
type: boolean
description: QRT state. Some APIs return spots marked as QRT. Otherwise we can check the comments.
@@ -1363,7 +1383,7 @@ components:
type: boolean
description: >
If true, forward the spot to an external upstream provider (e.g. POTA, SOTA) rather
than only adding it to this Spothole server. Requires `sig`, at least one `sig_refs`
than only adding it to this Spothole server. Requires `activity`, at least one `activity_refs`
entry, and `upstream_provider` to be set. Check `spot_submit_providers` in the
/options response to see which activities and providers support this.
default: false
@@ -1452,6 +1472,21 @@ components:
type: integer
description: ITU zone of the DX operator
example: 14
dx_grid:
type: string
description: >
Maidenhead grid locator for the activator's location, if known.
example: IO91aa
dx_latitude:
type: number
description: >
Latitude of the activator's location, if known, in degrees.
example: 51.2345
dx_longitude:
type: number
description: >
Longitude of the activator's location, if known, in degrees.
example: -1.2345
freqs_modes:
type: string
description: An indication of the frequencies and modes that the activation will use, if provided.
@@ -1487,14 +1522,14 @@ components:
type: string
description: Comment made by the activator, if any
example: "2025 DXpedition to null island"
sig:
description: Activity, e.g. outdoor activity programme such as POTA (still named "sig" in the API for backwards compatibility)
activity:
description: Activity, e.g. outdoor activity programme such as POTA
$ref: "#/components/schemas/ActivityName"
sig_refs:
activity_refs:
type: array
items:
$ref: '#/components/schemas/ActivityRef'
description: Activity references. We allow multiple here for e.g. n-fer activations, unlike ADIF SIG_INFO. Still named "sig_refs" in the API for backwards compatibility.
description: Activity references. We allow multiple here for e.g. n-fer activations, unlike ADIF SIG_INFO.
url:
type: string
description: A URL linking to more information about the alert, e.g. DXpedition or contest info.
@@ -1588,8 +1623,8 @@ components:
Activity:
type: object
description: >
Represents an activity (a term which replaces the older "Special Interest Group" or "SIG" terminology,
though `sig`-prefixed field names remain for API backwards compatibility).
Represents an activity, such as an outdoor activity programme (e.g. POTA), or another kind of operating
(e.g. Contest, DXpedition).
properties:
name:
description: The abbreviated name of the activity
@@ -1598,12 +1633,11 @@ components:
type: string
description: The full name of the activity
example: Parks on the Air
sig_type:
type: boolean
activity_type:
description: >
Whether the activity is traditional (e.g. EME), adventure (e.g. POTA), regional (e.g. WAB), or for a
specific event (e.g. MOTA). Generally for Spothole's own internal use, clients probably won't need this.
Used to group them in the web UI. Still named "sig_type" in the API for backwards compatibility.
Used to group them in the web UI.
$ref: "#/components/schemas/ActivityType"
has_refs:
type: boolean
@@ -1982,7 +2016,7 @@ components:
StaticDataProviderStatus:
type: object
properties:
sig_name:
name:
type: string
description: The name of the provider.
example: K0SWE
@@ -2004,9 +2038,9 @@ components:
ActivityRefDataProviderStatus:
type: object
properties:
sig_name:
activity_name:
type: string
description: The name of the activity. Still named "sig_name" in the API for backwards compatibility.
description: The name of the activity.
example: WWFF
enabled:
type: boolean
@@ -2030,7 +2064,7 @@ components:
CallsignDataProviderStatus:
type: object
properties:
sig_name:
name:
type: string
description: The name of the provider.
example: Country Files
@@ -2169,7 +2203,7 @@ components:
description: An array of all the static reference data providers.
items:
$ref: '#/components/schemas/StaticDataProviderStatus'
sig_ref_data_providers:
activity_ref_data_providers:
type: array
description: An array of all the activity reference data providers.
items:
@@ -2200,7 +2234,7 @@ components:
items:
type: string
example: "PHONE"
sigs:
activities:
type: array
description: An array of all the supported activities.
items:
@@ -2238,7 +2272,7 @@ components:
type: integer
description: >
The maximum age, in seconds, of any spot before it will be deleted by the system. When
querying the /api/v2/spots endpoint and providing a "max_age" or "since" parameter, there
querying the /api/v3/spots endpoint and providing a "max_age" or "since" parameter, there
is no point providing a number larger than this, because the system drops all spots older
than this.
example: 3600
+13 -13
View File
@@ -29,7 +29,7 @@ const PROVIDER_CREDENTIAL_SCHEMAS = {
// Load server options. Once a successful callback is made from this, we can populate the choice boxes in the form and load
// any saved values from local storage.
function loadOptions() {
$.getJSON('/api/v2/options', function (jsonData) {
$.getJSON('/api/v3/options', function (jsonData) {
// Store options
options = jsonData;
@@ -42,8 +42,8 @@ function loadOptions() {
});
// Populate activity drop-down
$.each(options["sigs"], function (i, activity) {
$('#sig').append($('<option>', {
$.each(options["activities"], function (i, activity) {
$('#activity').append($('<option>', {
value: activity.name,
text: activity.name
}));
@@ -91,8 +91,8 @@ function updateUpstreamArea() {
return;
}
const sig = $("#sig").val();
const providers = (sig && options["spot_submit_providers"][sig]) ? options["spot_submit_providers"][sig] : [];
const activity = $("#activity").val();
const providers = (activity && options["spot_submit_providers"][activity]) ? options["spot_submit_providers"][activity] : [];
if (providers.length === 0) {
$("#upstream-area").hide();
@@ -131,8 +131,8 @@ function updateCredentialsButton() {
// Get the currently selected upstream provider name
function getSelectedUpstreamProvider() {
const providers = (options && options["spot_submit_providers"] && $("#sig").val())
? (options["spot_submit_providers"][$("#sig").val()] || [])
const providers = (options && options["spot_submit_providers"] && $("#activity").val())
? (options["spot_submit_providers"][$("#activity").val()] || [])
: [];
if (providers.length === 0) return null;
if (providers.length === 1) return providers[0];
@@ -197,8 +197,8 @@ function addSpot() {
const dx = $("#dx-call").val().toUpperCase();
const freqStr = $("#freq").val();
const mode = $("#mode")[0].value;
const sig = $("#sig")[0].value;
const sigRef = $("#sig-ref").val();
const activity = $("#activity")[0].value;
const activityRef = $("#activity-ref").val();
const dxGrid = $("#dx-grid").val();
const comment = $("#comment").val();
const de = $("#de-call").val().toUpperCase();
@@ -208,8 +208,8 @@ function addSpot() {
spot["dx_call"] = dx;
spot["freq"] = parseFloat(freqStr) * 1000;
if (mode !== "") spot["mode"] = mode;
if (sig !== "") spot["sig"] = sig;
if (sigRef !== "") spot["sig_refs"] = [{sig: sig, id: sigRef}];
if (activity !== "") spot["activity"] = activity;
if (activityRef !== "") spot["activity_refs"] = [{activity: activity, id: activityRef}];
if (dxGrid !== "") spot["dx_grid"] = dxGrid;
if (comment !== "") spot["comment"] = comment;
spot["de_call"] = de;
@@ -232,7 +232,7 @@ function addSpot() {
handling["upstream_credentials"] = loadCredentials(upstreamProviderName);
}
$.ajax("/api/v2/spot", {
$.ajax("/api/v3/spot", {
data: JSON.stringify({spot, handling}),
contentType: 'application/json',
type: 'POST',
@@ -291,7 +291,7 @@ $("#mode").change(function () {
});
// Update upstream area and credentials button when activity changes
$("#sig").change(function () {
$("#activity").change(function () {
updateUpstreamArea();
});
+19 -14
View File
@@ -10,7 +10,7 @@ let alerts = [];
// to alerts
function loadAlerts() {
$.ajax({
url: '/api/v2/alerts' + buildQueryString(), dataType: 'json', success: function (jsonData) {
url: '/api/v3/alerts' + buildQueryString(), dataType: 'json', success: function (jsonData) {
// Store last updated time
lastUpdateTime = moment.utc();
// Store data
@@ -24,7 +24,7 @@ function loadAlerts() {
// Build a query string for the API, based on the filters that the user has selected.
function buildQueryString() {
let str = "?";
["dx_continent", "source", "sig"].forEach(fn => {
["dx_continent", "source", "activity"].forEach(fn => {
if (!allFilterOptionsSelected(fn)) {
str = str + getQueryStringFor(fn) + "&";
}
@@ -210,14 +210,14 @@ function addAlertRowsToTable(tbody, alerts) {
if (a["dx_calls"] != null) {
dx_calls_html = a["dx_calls"].map(call => `<a class='dx-link' href='https://qrz.com/db/${call}' target='_new'>${call}</a>`).join(", ");
}
if (dx_calls_html === "" && a["sig"] === "Contest") {
if (dx_calls_html === "" && a["activity"] === "Contest") {
// Contest = true and no DX callsigns, so display "Contest"
dx_calls_html = "Contest"
}
// Format DXpedition country
let dx_country_html = "";
if (a["sig"] === "DXpedition" && a["dx_country"] != null && a["dx_country"] !== "") {
if (a["activity"] === "DXpedition" && a["dx_country"] != null && a["dx_country"] !== "") {
dx_country_html = `<br/>${a["dx_country"]}`;
}
@@ -252,19 +252,24 @@ function addAlertRowsToTable(tbody, alerts) {
// Activity or fallback to "General DX"
let activityText = "General DX";
if (a["sig"]) {
activityText = a["sig"];
if (a["activity"]) {
activityText = a["activity"];
}
// Format activity refs
let activityRefs = "";
if (a["sig_refs"] != null) {
if (a["activity_refs"] != null) {
const items = [];
for (let i = 0; i < a["sig_refs"].length; i++) {
if (a["sig_refs"][i]["url"] != null) {
items[i] = `<a href='${encodeURI(a["sig_refs"][i]["url"])}' title='${escapeHtml(a["sig_refs"][i]["name"])}' target='_new' class='activity-ref-link'>${escapeHtml(a["sig_refs"][i]["id"])}</a>`
for (let i = 0; i < a["activity_refs"].length; i++) {
if (a["activity_refs"][i]["url"] != null) {
items[i] = `<a href='${encodeURI(a["activity_refs"][i]["url"])}' title='${escapeHtml(a["activity_refs"][i]["name"])}' target='_new' class='activity-ref-link'>${escapeHtml(a["activity_refs"][i]["id"])}</a>`
} else {
items[i] = `${escapeHtml(a["sig_refs"][i]["id"])}`
items[i] = `${escapeHtml(a["activity_refs"][i]["id"])}`
}
// If this is a satellite alert the ref will just be the satellite, but DX grid is also important, so
// show that if we can.
if (a["activity_refs"][i]["activity"] === "Satellite" && a["dx_grid"] != null) {
items[i] += " from " + a["dx_grid"];
}
}
activityRefs = items.join(", ");
@@ -278,7 +283,7 @@ function addAlertRowsToTable(tbody, alerts) {
$tr.append(`<td class='nowrap'>${end_time_formatted}</td>`);
}
if (showDX) {
$tr.append(`<td class='nowrap'><span class='flag-wrapper hideonmobile' title='${dx_country}'>${dx_flag}</span>${dx_calls_html}${dx_country_html}</td>`);
$tr.append(`<td><span class='flag-wrapper hideonmobile' title='${dx_country}'>${dx_flag}</span>${dx_calls_html}${dx_country_html}</td>`);
}
if (showFreqsModes) {
$tr.append(`<td class='hideonmobile'>${freqsModesText}</td>`);
@@ -325,7 +330,7 @@ function addAlertRowsToTable(tbody, alerts) {
// Load server options. Once a successful callback is made from this, we then query alerts.
function loadOptions() {
$.getJSON('/api/v2/options', function (jsonData) {
$.getJSON('/api/v3/options', function (jsonData) {
// Store options
options = jsonData;
@@ -333,7 +338,7 @@ function loadOptions() {
generateMultiToggleFilterCard("#dx_continent_options", "dx_continent", options["continents"]);
generateMultiToggleFilterCard("#source-options", "source", options["alert_providers"]);
// Alerts can only ever be tagged with activities that have an alert source, so only offer those as filters here
generateActivitiesMultiToggleFilterCard(options["sigs"].filter(o => o["alerts_possible"]), false);
generateActivitiesMultiToggleFilterCard(options["activities"].filter(o => o["alerts_possible"]), false);
// Load URL params. These may select things from the various filter & display options, so the function needs
// to be called after these are set up, but if the URL params ask for "embedded mode", this will suppress
+5 -5
View File
@@ -20,7 +20,7 @@ function loadSpots() {
sseAbortController.abort();
}
$.ajax({
url: '/api/v2/spots' + buildQueryString(), dataType: 'json', success: function (jsonData) {
url: '/api/v3/spots' + buildQueryString(), dataType: 'json', success: function (jsonData) {
// Store data
spots = jsonData;
// Update bands display
@@ -39,7 +39,7 @@ function startSSEConnection() {
sseAbortController = new AbortController();
// No need to include QRZ/HamQTH credentials because the information wouldn't be displayed on the bands panel anyway
fetchEventSource('/api/v2/spots/stream' + buildQueryString(), {
fetchEventSource('/api/v3/spots/stream' + buildQueryString(), {
signal: sseAbortController.signal,
openWhenHidden: true,
@@ -80,7 +80,7 @@ function expireOldSpots() {
// in the bands page's version of this, because nothing QRZ.com/HamQTH can provide will affect the display.
function buildQueryString() {
let str = "?";
["dx_continent", "de_continent", "mode", "source", "band", "sig"].forEach(fn => {
["dx_continent", "de_continent", "mode", "source", "band", "activity"].forEach(fn => {
if (!allFilterOptionsSelected(fn)) {
str = str + getQueryStringFor(fn) + "&";
}
@@ -281,7 +281,7 @@ function removeDuplicatesForBandPanel(spotList) {
// Load server options. Once a successful callback is made from this, we then query spots and set up the timer to query
// spots repeatedly.
function loadOptions() {
$.getJSON('/api/v2/options', function (jsonData) {
$.getJSON('/api/v3/options', function (jsonData) {
// Store options
options = jsonData;
@@ -295,7 +295,7 @@ function loadOptions() {
// Populate the filters panel
generateBandsMultiToggleFilterCard(options["bands"]);
generateActivitiesMultiToggleFilterCard(options["sigs"]);
generateActivitiesMultiToggleFilterCard(options["activities"]);
generateMultiToggleFilterCard("#dx_continent_options", "dx_continent", options["continents"]);
generateMultiToggleFilterCard("#de_continent_options", "de_continent", options["continents"]);
generateModesMultiToggleFilterCard(options["modes"]);
+9 -9
View File
@@ -67,7 +67,7 @@ function loadURLParams() {
updateSelectFromParam(params, "limit", "alerts_to_fetch"); // Only on Alerts page
updateSelectFromParam(params, "max_age", "max_spot_age"); // Only on Map & Bands pages
updateFilterFromParam(params, "band", "band");
updateFilterFromParam(params, "sig", "sig");
updateFilterFromParam(params, "activity", "activity");
updateFilterFromParam(params, "source", "source");
updateFilterFromParam(params, "mode", "mode");
updateFilterFromParam(params, "dx_continent", "dx_continent");
@@ -156,41 +156,41 @@ function buildActivityFilterGrid(activity_options) {
const $grid = $('<div class="row row-cols-2 g-1 mb-1">');
activity_options.forEach(o => {
const domSafeName = o["name"].replace(/^[^A-Za-z0-9]+|[^\w]+/gi, "");
$grid.append(`<div class="col"><div class="form-check"><input type="checkbox" class="form-check-input filter-button-sig storeable-checkbox" id="filter-button-sig-${domSafeName}" value="${o['name']}" autocomplete="off" onClick="filtersUpdated()" checked><label class="form-check-label" id="filter-button-label-sig-${domSafeName}" for="filter-button-sig-${domSafeName}" title="${o['description']}"><i class="fa-solid ${o['icon']}"></i> ${o['name']} ${(o["region_flag"] != null) ? o['region_flag'] : ''}</label></div></div>`);
$grid.append(`<div class="col"><div class="form-check"><input type="checkbox" class="form-check-input filter-button-activity storeable-checkbox" id="filter-button-activity-${domSafeName}" value="${o['name']}" autocomplete="off" onClick="filtersUpdated()" checked><label class="form-check-label" id="filter-button-label-activity-${domSafeName}" for="filter-button-activity-${domSafeName}" title="${o['description']}"><i class="fa-solid ${o['icon']}"></i> ${o['name']} ${(o["region_flag"] != null) ? o['region_flag'] : ''}</label></div></div>`);
});
return $grid;
}
// Generate activities filter card. This one is also a special case. includeGeneralDX controls whether the "General
// DX" (NO_SIG) option is offered - this doesn't apply on the alerts page, where every alert has an activity.
// DX" (NO_ACTIVITY) option is offered - this doesn't apply on the alerts page, where every alert has an activity.
function generateActivitiesMultiToggleFilterCard(activity_options, includeGeneralDX = true) {
const $list = $('<ul class="list-unstyled filter-section-list ps-0">');
const traditional = activity_options.filter(o => o["sig_type"] === "TRADITIONAL");
const traditional = activity_options.filter(o => o["activity_type"] === "TRADITIONAL");
appendActivityFilterSection($list, 'traditional', 'Traditional', true, includeGeneralDX || traditional.length > 0, $body => {
if (includeGeneralDX) {
$body.append(`<div class="w-100 mb-1"><div class="form-check"><input type="checkbox" class="form-check-input filter-button-sig storeable-checkbox" id="filter-button-sig-NO_SIG" value="NO_SIG" autocomplete="off" onClick="filtersUpdated()" checked><label class="form-check-label" id="filter-button-label-sig-NO_SIG" for="filter-button-sig-NO_SIG"><i class="fa-solid fa-tower-cell"></i> General DX</label></div></div>`);
$body.append(`<div class="w-100 mb-1"><div class="form-check"><input type="checkbox" class="form-check-input filter-button-activity storeable-checkbox" id="filter-button-activity-NO_ACTIVITY" value="NO_ACTIVITY" autocomplete="off" onClick="filtersUpdated()" checked><label class="form-check-label" id="filter-button-label-activity-NO_ACTIVITY" for="filter-button-activity-NO_ACTIVITY"><i class="fa-solid fa-tower-cell"></i> General DX</label></div></div>`);
}
$body.append(buildActivityFilterGrid(traditional));
});
const adventure = activity_options.filter(o => o["sig_type"] === "ADVENTURE");
const adventure = activity_options.filter(o => o["activity_type"] === "ADVENTURE");
appendActivityFilterSection($list, 'adventure', 'Adventure', true, adventure.length > 0, $body => {
$body.append(buildActivityFilterGrid(adventure));
});
const regional = activity_options.filter(o => o["sig_type"] === "REGIONAL");
const regional = activity_options.filter(o => o["activity_type"] === "REGIONAL");
appendActivityFilterSection($list, 'regional', 'Regional', false, regional.length > 0, $body => {
$body.append(buildActivityFilterGrid(regional));
});
const event = activity_options.filter(o => o["sig_type"] === "EVENT");
const event = activity_options.filter(o => o["activity_type"] === "EVENT");
appendActivityFilterSection($list, 'event', 'Event', false, event.length > 0, $body => {
$body.append(buildActivityFilterGrid(event));
});
$("#activity-options").append($list);
$("#activity-options").append(`<div class="mt-1"><a href="#" onclick="toggleFilterButtons('sig', true); return false;">All</a> &nbsp; <a href="#" onclick="toggleFilterButtons('sig', false); return false;">None</a></div>`);
$("#activity-options").append(`<div class="mt-1"><a href="#" onclick="toggleFilterButtons('activity', true); return false;">All</a> &nbsp; <a href="#" onclick="toggleFilterButtons('activity', false); return false;">None</a></div>`);
}
// Method called when "All" or "None" is clicked
+2 -2
View File
@@ -10,7 +10,7 @@ let ionosondeChart = null;
// Load solar conditions
function loadSolarConditions() {
$.getJSON('/api/v2/solar', function (jsonData) {
$.getJSON('/api/v3/solar', function (jsonData) {
// HF
@@ -660,7 +660,7 @@ function dxStatsContientChanged() {
// Fetch DX stats from the API and render
function loadDxStats() {
$.getJSON('/api/v2/dxstats', function (jsonData) {
$.getJSON('/api/v3/dxstats', function (jsonData) {
dxStatsData = jsonData;
renderDxStats();
});
+13 -13
View File
@@ -45,7 +45,7 @@ function loadSpots() {
// 3) Subscribe to the SSE endpoint (with credentials if we have them) so that updates come with augmented
// data if they can.
$.ajax({
url: '/api/v2/spots' + buildQueryString(), dataType: 'json', success: function (jsonData) {
url: '/api/v3/spots' + buildQueryString(), dataType: 'json', success: function (jsonData) {
// Store data
spots = jsonData;
// Update map
@@ -58,7 +58,7 @@ function loadSpots() {
// OK, we have credentials and have loaded once without them so the user has a basic map. Now reload
// with the credentials and replace what's on the map, so we can improve the data.
$.ajax({
url: '/api/v2/spots' + buildQueryString(),
url: '/api/v3/spots' + buildQueryString(),
dataType: 'json',
headers: getCredentialHeaders(),
success: function (jsonData2) {
@@ -85,7 +85,7 @@ function startSSEConnection() {
sseAbortController = new AbortController();
// SSE is going to fetch only a few spots at a time, so now we include QRZ/HamQTH credentials because the delay won't be significant.
fetchEventSource('/api/v2/spots/stream' + buildQueryString(), {
fetchEventSource('/api/v3/spots/stream' + buildQueryString(), {
headers: getCredentialHeaders(),
signal: sseAbortController.signal,
openWhenHidden: true,
@@ -183,7 +183,7 @@ function removeSpotFromMap(key) {
// Build a query string for the API, based on the filters that the user has selected.
function buildQueryString() {
let str = "?";
["dx_continent", "de_continent", "mode", "source", "band", "sig"].forEach(fn => {
["dx_continent", "de_continent", "mode", "source", "band", "activity"].forEach(fn => {
if (!allFilterOptionsSelected(fn)) {
str = str + getQueryStringFor(fn) + "&";
}
@@ -276,19 +276,19 @@ function getTooltipText(s) {
// Activity or fallback to source
let activitySourceText = s["source"];
if (s["sig"]) {
activitySourceText = s["sig"];
if (s["activity"]) {
activitySourceText = s["activity"];
}
// Format activity refs
let activityRefs = "";
if (s["sig_refs"] != null) {
if (s["activity_refs"] != null) {
const items = [];
for (let i = 0; i < s["sig_refs"].length; i++) {
if (s["sig_refs"][i]["url"] != null) {
items[i] = `<a href='${s["sig_refs"][i]["url"]}' title='${s["sig_refs"][i]["name"]}' target='_new' class='activity-ref-link'>${s["sig_refs"][i]["id"]}</a>`
for (let i = 0; i < s["activity_refs"].length; i++) {
if (s["activity_refs"][i]["url"] != null) {
items[i] = `<a href='${s["activity_refs"][i]["url"]}' title='${s["activity_refs"][i]["name"]}' target='_new' class='activity-ref-link'>${s["activity_refs"][i]["id"]}</a>`
} else {
items[i] = `${s["sig_refs"][i]["id"]}`
items[i] = `${s["activity_refs"][i]["id"]}`
}
}
activityRefs = items.join(", ");
@@ -325,7 +325,7 @@ function getTooltipText(s) {
// Load server options. Once a successful callback is made from this, we then query spots and set up the timer to query
// spots repeatedly.
function loadOptions() {
$.getJSON('/api/v2/options', function (jsonData) {
$.getJSON('/api/v3/options', function (jsonData) {
// Store options
options = jsonData;
@@ -339,7 +339,7 @@ function loadOptions() {
// Populate the filters panel
generateBandsMultiToggleFilterCard(options["bands"]);
generateActivitiesMultiToggleFilterCard(options["sigs"]);
generateActivitiesMultiToggleFilterCard(options["activities"]);
generateMultiToggleFilterCard("#dx_continent_options", "dx_continent", options["continents"]);
generateMultiToggleFilterCard("#de_continent_options", "de_continent", options["continents"]);
generateModesMultiToggleFilterCard(options["modes"]);
+12 -12
View File
@@ -20,7 +20,7 @@ function loadSpots() {
// Make the new query. No credential headers on the first load to keep things quick
$.ajax({
url: '/api/v2/spots' + buildQueryString(), dataType: 'json', success: function (jsonData) {
url: '/api/v3/spots' + buildQueryString(), dataType: 'json', success: function (jsonData) {
// Store data
spots = jsonData;
// Update table
@@ -43,7 +43,7 @@ function startSSEConnection() {
sseAbortController = new AbortController();
// SSE is going to fetch only a few spots at a time, so now we include QRZ/HamQTH credentials because the delay won't be significant.
fetchEventSource('/api/v2/spots/stream' + buildQueryString(), {
fetchEventSource('/api/v3/spots/stream' + buildQueryString(), {
headers: getCredentialHeaders(),
signal: sseAbortController.signal,
openWhenHidden: true,
@@ -100,7 +100,7 @@ function startSSEConnection() {
// Build a query string for the API, based on the filters that the user has selected.
function buildQueryString() {
let str = "?";
["dx_continent", "de_continent", "mode", "source", "band", "sig"].forEach(fn => {
["dx_continent", "de_continent", "mode", "source", "band", "activity"].forEach(fn => {
if (!allFilterOptionsSelected(fn)) {
str = str + getQueryStringFor(fn) + "&";
}
@@ -329,19 +329,19 @@ function createNewTableRowsForSpot(s, highlightNew) {
// Format activity
let activityText = "General DX";
if (s["sig"]) {
activityText = s["sig"];
if (s["activity"]) {
activityText = s["activity"];
}
// Format activity refs
let activityRefs = "";
if (s["sig_refs"] != null) {
if (s["activity_refs"] != null) {
const items = [];
for (let i = 0; i < s["sig_refs"].length; i++) {
if (s["sig_refs"][i]["url"] != null) {
items[i] = `<span style="white-space: nowrap;"><a href='${encodeURI(s["sig_refs"][i]["url"])}' title='${escapeHtml(s["sig_refs"][i]["name"])}' target='_new' class='activity-ref-link'>${escapeHtml(s["sig_refs"][i]["id"])}</a></span>`
for (let i = 0; i < s["activity_refs"].length; i++) {
if (s["activity_refs"][i]["url"] != null) {
items[i] = `<span style="white-space: nowrap;"><a href='${encodeURI(s["activity_refs"][i]["url"])}' title='${escapeHtml(s["activity_refs"][i]["name"])}' target='_new' class='activity-ref-link'>${escapeHtml(s["activity_refs"][i]["id"])}</a></span>`
} else {
items[i] = `<span style="white-space: nowrap;">${escapeHtml(s["sig_refs"][i]["id"])}</span>`
items[i] = `<span style="white-space: nowrap;">${escapeHtml(s["activity_refs"][i]["id"])}</span>`
}
}
activityRefs = items.join(", ");
@@ -464,7 +464,7 @@ function createNewTableRowsForSpot(s, highlightNew) {
// Load server options. Once a successful callback is made from this, we then query spots and set up the timer to query
// spots repeatedly.
function loadOptions() {
$.getJSON('/api/v2/options', function (jsonData) {
$.getJSON('/api/v3/options', function (jsonData) {
// Store options
options = jsonData;
@@ -478,7 +478,7 @@ function loadOptions() {
// Populate the filters panel
generateBandsMultiToggleFilterCard(options["bands"]);
generateActivitiesMultiToggleFilterCard(options["sigs"]);
generateActivitiesMultiToggleFilterCard(options["activities"]);
generateMultiToggleFilterCard("#dx_continent_options", "dx_continent", options["continents"]);
generateMultiToggleFilterCard("#de_continent_options", "de_continent", options["continents"]);
generateModesMultiToggleFilterCard(options["modes"]);
+4 -4
View File
@@ -1,6 +1,6 @@
// Load server status
function loadStatus() {
$.getJSON('/api/v2/status', function (jsonData) {
$.getJSON('/api/v3/status', function (jsonData) {
$("#software_version").text(jsonData["software_version"]);
$("#server_owner_callsign").text(jsonData["server_owner_callsign"]);
$("#up-since").text(moment().subtract(jsonData["uptime"], 'seconds').fromNow());
@@ -54,10 +54,10 @@ function loadStatus() {
</div>`);
});
jsonData["sig_ref_data_providers"].forEach(p => {
$("#sig_ref_data_providers-status-container").append(`
jsonData["activity_ref_data_providers"].forEach(p => {
$("#activity_ref_data_providers-status-container").append(`
<div class="row row-cols-1 row-cols-md-4 g-4 mb-4 mb-md-2">
<div class="col"><strong>${p["sig_name"]}</strong></div>
<div class="col"><strong>${p["activity_name"]}</strong></div>
<div class="col">Status: ${p["status"]}</div>
<div class="col">Last updated: ${(p["enabled"] && p["last_updated"] > 0) ? moment.unix(p["last_updated"]).utc().fromNow() : "N/A"}</div>
<div class="col">References: ${p["enabled"] ? p["reference_count"] : "N/A"}</div>
+8 -2
View File
@@ -123,13 +123,19 @@ class TelnetServer:
except asyncio.CancelledError:
pass
except (TimeoutError, ConnectionResetError):
logger.debug("Telnet client connection timed out or was reset by client")
except Exception:
logger.exception("Exception handling telnet client")
finally:
logger.debug("Telnet client disconnected")
self._clients.remove(writer)
writer.close()
await writer.wait_closed()
try:
writer.close()
await writer.wait_closed()
except (TimeoutError, ConnectionResetError, OSError):
# Socket already closed or timed out, don't care as we were getting rid of it anyway
pass
def stop(self):
"""Stops the telnet server"""
-236
View File
@@ -1,236 +0,0 @@
{% extends "base.html" %}
{% block content %}
<div id="info-container" class="mt-4">
<h2 class="mt-4 mb-4">About Spothole</h2>
<p>Spothole is a utility to aggregate "spots" from amateur radio DX clusters and xOTA spotting sites, and provide an
open JSON API as well as a website to browse the data.</p>
<p>While there are several other web-based interfaces to DX clusters, and sites that aggregate spots from various
outdoor activity programmes for amateur radio, Spothole differentiates itself by supporting a larger number of
data sources, and by being "API first" rather than just providing a web front-end. This allows other software to
be built on top of it.</p>
<p>The API is deliberately well-defined with an <a href="/apidocs/openapi.yml">OpenAPI specification</a> and <a
href="/apidocs">API documentation</a>. The API delivers spots in a consistent format regardless of the data
source, freeing developers from needing to know how each individual data source presents its data.</p>
<p>Spothole itself is also open source, Public Domain licenced code that anyone can take and modify. <a
href="https://git.ianrenton.com/ian/spothole/">The source code is here</a>.</p>
<p>The software was written by <a href="https://ianrenton.com">Ian Renton, MØTRT</a> with code contributions by
Steven, M1SDH. The full list of thanks due to others can be found at the bottom of this page.</p>
<p>This server is running Spothole version {{software_version}}.</p>
<h2 class="mt-4 mb-4">Using Spothole</h2>
<p>There are a number of different ways to use Spothole, depending on what you want to do with it and your level of
technical skill:</p>
<ol>
<li>You can <b>use it on the web</b>, like you are (probably) doing right now. This is how most people use it,
to look up spots and alerts, and make interesting QSOs.
</li>
<li>If you are using an Android or iOS device, you can <b>"install" it on your device</b>. Spothole is a
Progressive Web App, meaning it's not delivered through app stores, but if you open the page on Chrome
(Android) or Safari (iOS) there will be an option in the menu to install it. It will then appear in your
main app menu.
</li>
<li>You can <b>embed the web interface in another website</b> to show its spots in a custom dashboard or the
like. The usage is explained in more detail in the <a
href="https://git.ianrenton.com/ian/spothole/src/branch/main/README.md">README file</a>.
</li>
{% if telnet_server_enabled %}
<li>You can use it as a traditional telnet-based source of spots, similar to DXSpider and other software, <b>in
your desktop logging application</b>. To do this, set up your logger with the server address
<code>{{ telnet_server_address }}</code> and port <code>{{ telnet_server_port }}</code>. You can also access
it from a terminal with <code>telnet {{ telnet_server_address }} {{ telnet_server_port }}</code>.
</li>
{% end %}
<li>You can <b>write your own client using the Spothole API</b>, using the main Spothole instance to provide
data, and do whatever you like with it. The README contains guidance on how to do this, and the full API
docs are linked above. You can also find reference implementations in the form of Spothole's own web-based
front end, plus my other two tools built on Spothole: <a href="https://fieldspotter.radio">Field Spotter</a>
and the <a href="https://qsomap.m0trt.radio">QSO Map Tool</a>.
</li>
<li>If you want to <b>run your own version of Spothole</b> so you can customise the configuration, such as
enabling sources that I disable on the main instance, you can do that too. The README contains not only
advice on how to set up Spothole but how to get it auto-starting with systemd, using an nginx reverse proxy,
and setting up HTTPS support with certbot.
</li>
<li>Finally, you can of course download the source code and <b>develop Spothole to meet your needs</b>. Whether
you contribute your changes back to the main repository is up to you. As usual, the README file contains
some advice on the structure of the repository, and how to get started writing your own spot provider.
</li>
</ol>
<h2 id="faq" class="mt-4">FAQ</h2>
<h4 class="mt-4">"Spots"? "DX Clusters"? What does any of this mean?</h4>
<p>This is a tool for amateur ("ham") radio users. Many amateur radio operators like to make contacts with others
who are doing something more interesting than sitting in their home "shack", such as people in rarely-seen
countries, remote islands, or on mountaintops. Such operators are often "spotted", i.e. when someone speaks to
them, they will put the details such as their operating frequency into an online system, to let others know
where to find them. A DX Cluster is one type of those systems. Most outdoor radio awards programmes, such as
"Parks on the Air" (POTA) have their own websites for posting spots.</p>
<p>Spothole is an "aggregator" for those spots, so it checks lots of different services for data, and brings it all
together in one place. So no matter what kinds of interesting spots you are looking for, you can find them
here.</p>
<p>As well as spots, it also provides a similar feed of "alerts". This is where amateur radio users who are going to
interesting places soon will announce their intentions.</p>
<h4 class="mt-4">What are "DX", "DE" and modes?</h4>
<p>In amateur radio terminology, the "DX" contact is the "interesting" one that is using the frequency shown and
looking for callers. They might be on a remote island or just in a local park, but either way it's interesting
enough that someone has "spotted" them. The callsign listed under "DE" is the person who entered the spot of the
"DX" operator. "Modes" are the type of communication they are using. For example you might see "CW" which is
Morse Code, or voice "modes" like SSB or FM, or more exotic "data" modes which are used for computer-to-computer
communication.</p>
<h4 class="mt-4">What data sources are supported?</h4>
<p>Spothole can retrieve spots from: <a href="https://www.dxcluster.info/telnet/">Telnet-based DX clusters</a>, the
<a href="https://www.reversebeacon.net/">Reverse Beacon Network (RBN)</a>, the <a
href="https://www.aprs-is.net/">APRS Internet Service (APRS-IS)</a>, <a href="https://pota.app">POTA</a>,
<a href="https://www.sota.org.uk/">SOTA</a>, <a href="https://wwff.co/">WWFF</a>, <a
href="https://www.cqgma.org/">GMA</a>, <a href="https://wwbota.net/">WWBOTA</a>, <a
href="http://www.hema.org.uk/">HEMA</a>, <a href="https://www.parksnpeaks.org/">Parks 'n' Peaks</a>, <a
href="https://ontheair.nz">ZLOTA</a>, <a href="https://www.wota.org.uk/">WOTA</a>, <a
href="https://llota.app">LLOTA</a>, <a href="https://wwtota.com">WWTOTA</a>, <a
href="https://tilesontheair.com/">Tiles on the Air</a>, the <a href="https://ukpacketradio.network/">UK
Packet Repeater Network</a>, and any site based on the <a href="https://github.com/nischu/xOTA">xOTA
software by nischu</a>.</p>
<p>Spothole can retrieve alerts from: <a href="https://www.ng3k.com/">NG3K</a>, <a href="https://pota.app">POTA</a>,
<a href="https://www.sota.org.uk/">SOTA</a>, <a href="https://wwff.co/">WWFF</a>, <a
href="https://www.parksnpeaks.org/">Parks 'n' Peaks</a>, <a href="https://www.wota.org.uk/">WOTA</a> and
<a href="https://www.beachesontheair.com/">BOTA</a>. It also fetches contest dates from
<a href="https://contestcalendar.com/">WA7BNM Contest Calendar</a> and RSGB contest calendars.</p>
<p>Spothole can retrieve solar and propagation condition data from <a href="https://www.hamqsl.com">HamQSL</a>, the
<a href="https://www.swpc.noaa.gov/">NOAA Space Weather Prediction Center</a>, the <a
href="https://giro.uml.edu/">Lowell GIRO Data Center</a> and <a href="https://prop.kc2g.com/">prop.kc2g.com</a>
by KC2G.</p>
<p>Spothole can also perform lookups for callsign data on behalf of the user from <a
href="https://qrz.com">QRZ.com</a> and <a href="https://hamqth.com">HamQTH</a>.</p>
<p>Note that the server owner has not necessarily enabled all these data sources. In particular it is common to
disable RBN, to avoid the server being swamped with FT8 traffic, and to disable APRS-IS and UK Packet Net so
that the server only displays stations where there is likely to be an operator physically present for a QSO.</p>
<p>Between the various data sources, the following activities / special interest groups are supported: Contests,
DXpeditions, Aeronautical Mobile, Maritime Mobile, EME/Moonbounce, Amateur Satellite, QRP, Parks on the Air
(POTA), Summits on the Air (SOTA), Worldwide Flora & Fauna (WWFF), Global Mountain Activity (GMA), Worldwide
Bunkers on the Air (WWBOTA), HuMPs Excluding Marilyns Award (HEMA), Islands on the Air (IOTA), Mills on the Air
(MOTA), the Amateur Radio Lighthouse Society (ARLHS), International Lighthouse Lightship Weekend (ILLW), Silos
on the Air (SIOTA), World Castles Award (WCA), New Zealand on the Air (ZLOTA), Keith Roget Memorial National
Parks Award (KRMNPA), South Australia National Parks and Conservation Parks Award (SANPCPA), Wainwrights on the
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), Diploma Municipios de España (DME), Diploma
Faros de España (FEA), Diploma Muesos de España (DMUE), Diploma Castillos de España (DCE), Diploma Monumentos y
Vestigios de España (DMVE), Diploma Estaciones de Ferrocarril de España (DEFE), Diploma Teatri Musei e Belle
Arti (DTMBA), British Inland Waterways on the Air (BIWOTA), Castles on the Air (COTA), Polish Gmina Award (PGA),
Diplôme des Moulins de France (DMF), RaDAR Rally, and Toilets on the Air.</p>
<p>As of the time of writing in August 2026, I think Spothole captures most 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>
<h4 class="mt-4">Why can I filter spots by both Activity and Source? Isn't that basically the same thing?</h4>
<p>Mostly, but not quite. While POTA spots generally come from the POTA source and so on, there are a few
exceptions:</p>
<ol>
<li>Sources like GMA and Parks 'n' Peaks provide spots for multiple different programmes (activities).</li>
<li>Cluster spots may name activities in their comment, in which case the source remains the Cluster, but an
activity is assigned.
</li>
<li>Some activities, such as Worked all Britain (WAB), don't have their own spotting site and can <em>only</em>
be identified through comments on spots retrieved from other sources.
</li>
</ol>
<p>Spothole's web interface exists not just for the end user, but also as a reference implementation for the API, so
I have chosen to demonstrate both methods of filtering.</p>
<h4 class="mt-4">How is this better than DXheat, DXsummit, POTA's own website, etc?</h4>
<p>It's probably not? But it's nice to have choice.</p>
<p>I think it's got three key advantages over those sites:</p>
<ol>
<li>It provides a public, <a href="/apidocs">well-documented API</a> with an <a href="/apidocs/openapi.yml">OpenAPI
specification</a>. Other sites don't have official APIs or don't bother documenting them publicly, because
they want people to use their web page. I like Spothole's web page, but you don't have to use it&mdash;if
you're a programmer, you can build your own software on Spothole's API. Spothole does the hard work of
taking all the various data sources and providing a consistent, well-documented data set. You can then do
the fun bit of writing your own application.
</li>
<li>It grabs data from a lot more sources. I've seen other sites that pull in DX Cluster and POTA spots
together, but nothing on the scale of what Spothole supports.
</li>
<li>Spothole is open source, so anyone can contribute the code to support a new data source or add new features,
and share them with the community.
</li>
</ol>
<h4 class="mt-4">Why does this website ask me if I want to install it?</h4>
<p>Spothole is a Progressive Web App, which means you can install it on an Android or iOS device by opening the site
in Chrome or Safari respectively, and clicking "Install" on the pop-up panel. It'll only prompt you once, so if
you dismiss the prompt and change your mind, you'll find an Install / Add to Home Screen option on your
browser's menu.</p>
<p>Installing Spothole on your phone is completely optional, the website works exactly the same way as the "app"
does.</p>
<h4 class="mt-4">Why hasn't my spot/alert shown up yet?</h4>
<p>To avoid putting too much load on the various servers that Spothole connects to, the Spothole server only polls
them once every two minutes for spots, and once every 30 minutes for alerts. (Some sources, such as DX clusters,
RBN, APRS-IS and WWBOTA use a non-polling mechanism, and their updates will therefore arrive more quickly.) Then
if you are using the web interface, that has its own rate at which it fetches the data from Spothole. This is
instant for the main spots list, with new spots appearing immediately at the top of the list, while the map and
bands displays update once a minute, and the alerts display updates once every 5 minutes. So you could be
waiting around three minutes to see a newly added spot, or 40 minutes to see a newly added alert.</p>
<h4 class="mt-4">What licence does Spothole use?</h4>
<p>Spothole's source code is licenced under the Public Domain. You can write a Spothole client, run your own server,
modify it however you like, you can claim you wrote it and charge people £1000 for a copy, I don't really mind.
(Please don't do the last one. But if you're using my code for something cool, it would be nice to hear from
you!)</p>
<h4 class="mt-4">What commands are supported in the telnet server?</h4>
<p>Currently, <code>exit</code>, and nothing else. Support for some DXSpider-like commands may be added to Spothole
in due course, but at the moment if you want to add Spothole as a telnet cluster data source to your desktop
logging application, that application must handle filtering itself.</p>
<h2 id="accuracy" class="mt-4">Data Accuracy</h2>
<p>Please note that the data coming out of Spothole is only as good as the data going in. People mis-hear and make
typos when spotting callsigns all the time. There are also plenty of cases where Spothole's data, particularly
location data, may be inaccurate. For example, there are POTA parks that span multiple US states, countries that
span multiple CQ zones, portable operators with no requirement to sign /P, etc. If you are doing something where
accuracy is important, such as contesting, you should not rely on Spothole's data to fill in any gaps in your
log.</p>
<p>In the Spothole user interface, under "Your Data", you can enter your credentials for QRZ.com and/or HamQTH if
you have them. This allows Spothole to augment its data with lookups from these services. See the following
section, Privacy, for details of how these are handled. If you are looking at the map and see lots of spots in
the geographic centre of countries, allowing these lookups will help. For QRZ.com a paid account is required to
look up operator locations.</p>
<h2 id="privacy" class="mt-4">Privacy</h2>
<p>Spothole collects no data about you on a permanent basis. All spots and alerts are "timed out" and deleted from
the system after a set interval, which by default is one hour for spots and one week for alerts.</p>
<p>Settings you select from Spothole's menus are sent to the server, in order to provide the data with the requested
filters. They are also stored in your browser's local storage, so that your preferences are remembered between
sessions.</p>
<p>The data you provide can optionally include your login credentials for QRZ.com and HamQTH. You can provide these
in the "Your Data" menu of most pages. If you do, Spothole will augment the data it produces with lookups from
these
services, which can for example provide more accurate markers on the map tab, and operator names when you mouse
over a DX callsign. Spothole will still work fine if you don't provide these. The values you enter are sent to
Spothole via HTTPS so are protected in transit, though of course you do have to trust Spothole with this
sensitive data in order to use this feature.</p>
<p>Any data you send as part of a query, such as your QRZ or HamQTH credentials, is used only for the lifetime of
that
query and is not saved anywhere apart from your own device.</p>
<p>Spothole uses no trackers, no ads, and no cookies.</p>
{% if len(web_ui_options["support_button_html"]) > 0 %}
<p><strong>Caveat: </strong> The owner of this server has chosen to inject their own content into the "spots" page.
This is designed for a "donate" or "support this server" button. The functionality of this injected content is
the responsibility of the server owner, rather than the Spothole software.</p>
{% end %}
<p>Spothole is open source, so you can audit <a href="https://git.ianrenton.com/ian/spothole">the code</a> if you
like.</p>
<h2 class="mt-4">Thanks</h2>
<p>This project would not have been possible without those volunteers who have taken it upon themselves to run DX
clusters, xOTA programmes, DXpedition lists, callsign lookup databases, solar conditions and propagation
modelling software, and other online tools on which Spothole's data is based. The vast majority of these are not
profit-seeking and are made purely for the love of the hobby and to help others in the community. Spothole is
standing on the shoulders of giants, who deserve a huge amount of thanks for all the work they put in.</p>
<p>The following people have specifically helped develop Spothole either by contributing code, requesting features,
or helping squash bugs: Steven M1SDH, Dan S50U, Matt W1CDN, Norby LX1NO, Andrew VK3ARR, Mario DL4MFM, Mark M5TEA,
Michael G7VJR, Rob G7LAS, Ed DD5LP, Raph F4LUB, Luc ON7KEC, Richard GD4OFB, Daniel PY2TDB, Alan VK1AO,
Andrew WK1AD, Ullrich DF5WC, Wayne N3CDF, Jonathan G4IVV, Erik N2EPE, Sorin YO9TSN, Matt HB9HWI, Priit ES1TEB,
Leigh KG7WED, Jouni OH3CUF, Onno VK6FLAB, and Bruce WA7BNM. (If I've forgotten you, let me know!)</p>
<p>Spothole is also dependent on a number of Python libraries, such as pyhamtools, and many JavaScript
libraries, as well as the Font Awesome icon set and flag icons from the Noto Color Emoji set, and MIT-licenced
GeoJSON files for CQ and ITU zones from HA8TKS.</p>
<p>The project's name was suggested by Harm DK4HAA.</p>
<p>This software is dedicated to the memory of Tom G1PJB, SK, a friend and colleague who sadly passed away around
the time I started writing it in Autumn 2025. I was looking forward to showing it to you when it was done.</p>
</div>
<script>$(document).ready(function () {
$("#nav-link-about").addClass("active");
}); <!-- highlight active page in nav --></script>
{% end %}
@@ -41,14 +41,14 @@
</select>
</div>
<div class="col-auto">
<label for="sig" class="form-label">Activity</label>
<select id="sig" class="form-select">
<label for="activity" class="form-label">Activity</label>
<select id="activity" class="form-select">
<option value="" selected></option>
</select>
</div>
<div class="col-auto">
<label for="sig-ref" class="form-label">Activity Reference</label>
<input type="text" class="form-control input-narrow" id="sig-ref" placeholder="e.g. GB-0001">
<label for="activity-ref" class="form-label">Activity Reference</label>
<input type="text" class="form-control input-narrow" id="activity-ref" placeholder="e.g. GB-0001">
</div>
<div class="col-auto">
<label for="dx-grid" class="form-label">DX Grid</label>
@@ -77,7 +77,7 @@
</div>
<script src="/static/js/add-spot.js?v=1789894090"></script>
<script src="/static/js/add-spot.js?v=1790228319"></script>
<script>$(document).ready(function () {
$("#nav-link-add-spot").addClass("active");
}); <!-- highlight active page in nav --></script>
+1 -1
View File
@@ -85,7 +85,7 @@
</div>
<script src="/static/js/alerts.js?v=1789894090"></script>
<script src="/static/js/alerts.js?v=1790228319"></script>
<script>$(document).ready(function () {
$("#nav-link-alerts").addClass("active");
}); <!-- highlight active page in nav --></script>
+2 -2
View File
@@ -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=1790228319"></script>
<script src="/static/js/bands.js?v=1790228319"></script>
<script>$(document).ready(function () {
$("#nav-link-bands").addClass("active");
}); <!-- highlight active page in nav --></script>
+9 -9
View File
@@ -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=1790228319" 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=1790228319"></script>
<script src="/static/js/ui-ham.js?v=1790228319"></script>
<script src="/static/js/geo.js?v=1790228319"></script>
<script src="/static/js/common.js?v=1790228319"></script>
{% end %}
{% block body %}
<div class="container">
@@ -51,8 +51,8 @@
class="fa-solid fa-sun"></i> Conditions</a></li>
<li class="nav-item ms-4"><a href="/status" class="nav-link" id="nav-link-status"><i
class="fa-solid fa-chart-simple"></i> Status</a></li>
<li class="nav-item ms-4"><a href="/about" class="nav-link" id="nav-link-about"><i
class="fa-solid fa-circle-info"></i> About</a></li>
<li class="nav-item ms-4"><a href="/help" class="nav-link" id="nav-link-help"><i
class="fa-solid fa-circle-question"></i> Help</a></li>
<li class="nav-item ms-4"><a href="/apidocs" class="nav-link" id="nav-link-api"><i
class="fa-solid fa-gear"></i> API</a></li>
</ul>
@@ -75,10 +75,10 @@
v{{software_version}}</p>
<ul class="nav col-md-4 justify-content-end">
<li class="nav-item">
<a href="/about#faq" class="nav-link px-3 text-body-secondary">FAQ</a>
<a href="/help/faq" class="nav-link px-3 text-body-secondary">FAQ</a>
</li>
<li class="nav-item">
<a href="/about#privacy" class="nav-link px-3 text-body-secondary">Privacy</a>
<a href="/help/privacy" class="nav-link px-3 text-body-secondary">Privacy</a>
</li>
<li class="nav-item">
<a href="https://git.ianrenton.com/ian/spothole" class="nav-link px-3 text-body-secondary">Source
+1 -1
View File
@@ -27,7 +27,7 @@
</button>
</div>
<div class="mt-1">
<small>See <a href="/about#privacy">Privacy</a> for more information.</small>
<small>See <a href="/help/privacy">Privacy</a> for more information.</small>
</div>
</div>
</div>
+1 -1
View File
@@ -27,7 +27,7 @@
</button>
</div>
<div class="mt-1">
<small>See <a href="/about#privacy">Privacy</a> for more information.</small>
<small>See <a href="/help/privacy">Privacy</a> for more information.</small>
</div>
</div>
</div>
+1 -1
View File
@@ -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=1790228319"></script>
<script>$(document).ready(function () {
$("#nav-link-conditions").addClass("active");
}); <!-- highlight active page in nav --></script>
+43
View File
@@ -0,0 +1,43 @@
{% extends "base.html" %}
{% block content %}
<div id="info-container" class="mt-4">
<h2>Help and Information</h2>
<p>Welcome to Spothole's help pages.</p>
<p>Spothole is a utility to aggregate spots from amateur radio DX clusters and xOTA spotting sites, and provide an
open JSON API as well as a website to browse the data. (If that sounds like nonsense to you, I recommend
starting with the <a href="/help/faq">FAQ</a>!)</p>
<p>In the sections below, you can find more information about what Spothole is, and how to use it.</p>
<ul>
<li><a href="/help/about">About Spothole</a></li>
<li><a href="/help/usage">How to use Spothole</a>
<ul>
{% if telnet_server_enabled %}
<li><a href="/help/usage/telnet">Connecting via Telnet</a></li>
{% end %}
<li><a href="/help/usage/clients">Writing your own Client</a></li>
<li><a href="/help/usage/embedding">Embedding Spothole in Another Website</a></li>
<li><a href="/help/usage/running">Running your own Server</a></li>
<ul>
<li><a href="/help/usage/systemd">systemd Configuration</a></li>
<li><a href="/help/usage/nginx">nginx Reverse Proxy Configuration</a></li>
<li><a href="/help/usage/docker">Running using Docker</a></li>
<li><a href="/help/usage/multicluster">Multiple Cluster Nodes with Different Settings</a></li>
</ul>
<li><a href="/help/usage/modifying">Modifying the Source Code</a></li>
</ul>
</li>
<li><a href="/help/sources">Supported Data Sources</a></li>
<li><a href="/help/faq">Frequently Asked Questions (FAQ)</a></li>
<li><a href="/apidocs">API Documentation</a></li>
<li><a href="/help/accuracy">Data Accuracy</a></li>
<li><a href="/help/privacy">Privacy</a></li>
<li><a href="/help/thanks">Thanks</a></li>
</ul>
</div>
<script>$(document).ready(function () {
$("#nav-link-help").addClass("active");
}); <!-- highlight active page in nav --></script>
{% end %}
+18
View File
@@ -0,0 +1,18 @@
{% extends "help_page.html" %}
{% block help_content %}
<h2 class="mt-4 mb-4">About Spothole</h2>
<p>Spothole is a utility to aggregate "spots" from amateur radio DX clusters and xOTA spotting sites, and provide an
open JSON API as well as a website to browse the data.</p>
<p>While there are several other web-based interfaces to DX clusters, and sites that aggregate spots from various
outdoor activity programmes for amateur radio, Spothole differentiates itself by supporting a larger number of
data sources, and by being "API first" rather than just providing a web front-end. This allows other software to
be built on top of it.</p>
<p>The API is deliberately well-defined with an <a href="/apidocs/openapi.yml">OpenAPI specification</a> and <a
href="/apidocs">API documentation</a>. The API delivers spots in a consistent format regardless of the data
source, freeing developers from needing to know how each individual data source presents its data.</p>
<p>Spothole itself is also open source, Public Domain licenced code that anyone can take and modify. <a
href="https://git.ianrenton.com/ian/spothole/">The source code is here</a>.</p>
<p>This server is running Spothole version {{software_version}}.</p>
{% end %}
+17
View File
@@ -0,0 +1,17 @@
{% extends "help_page.html" %}
{% block help_content %}
<h2 class="mt-4">Data Accuracy</h2>
<p>Please note that the data coming out of Spothole is only as good as the data going in. People mis-hear and make
typos when spotting callsigns all the time. There are also plenty of cases where Spothole's data, particularly
location data, may be inaccurate. For example, there are POTA parks that span multiple US states, countries that
span multiple CQ zones, portable operators with no requirement to sign /P, etc. If you are doing something where
accuracy is important, such as contesting, you should not rely on Spothole's data to fill in any gaps in your
log.</p>
<p>In the Spothole user interface, under "Your Data", you can enter your credentials for QRZ.com and/or HamQTH if
you have them. This allows Spothole to augment its data with lookups from these services. See the <a
href="/help/privacy">Privacy</a> section for details of how these are handled. If you are looking at the
map and see lots of spots in the geographic centre of countries, allowing these lookups will help. For QRZ.com a
paid account is required to look up operator locations.</p>
{% end %}
+81
View File
@@ -0,0 +1,81 @@
{% extends "help_page.html" %}
{% block help_content %}
<h2 class="mt-4">Frequently Asked Questions (FAQ)</h2>
<h4 class="mt-4">"Spots"? "DX Clusters"? What does any of this mean?</h4>
<p>This is a tool for amateur ("ham") radio users. Many amateur radio operators like to make contacts with others
who are doing something more interesting than sitting in their home "shack", such as people in rarely-seen
countries, remote islands, or on mountaintops. Such operators are often "spotted", i.e. when someone speaks to
them, they will put the details such as their operating frequency into an online system, to let others know
where to find them. A DX Cluster is one type of those systems. Most outdoor radio awards programmes, such as
"Parks on the Air" (POTA) have their own websites for posting spots.</p>
<p>Spothole is an "aggregator" for those spots, so it checks lots of different services for data, and brings it all
together in one place. So no matter what kinds of interesting spots you are looking for, you can find them
here.</p>
<p>As well as spots, it also provides a similar feed of "alerts". This is where amateur radio users who are going to
interesting places soon will announce their intentions.</p>
<h4 class="mt-4">What are "DX", "DE" and modes?</h4>
<p>In amateur radio terminology, the "DX" contact is the "interesting" one that is using the frequency shown and
looking for callers. They might be on a remote island or just in a local park, but either way it's interesting
enough that someone has "spotted" them. The callsign listed under "DE" is the person who entered the spot of the
"DX" operator. "Modes" are the type of communication they are using. For example you might see "CW" which is
Morse Code, or voice "modes" like SSB or FM, or more exotic "data" modes which are used for computer-to-computer
communication.</p>
<h4 class="mt-4">Why can I filter spots by both Activity and Source? Isn't that basically the same thing?</h4>
<p>Mostly, but not quite. While POTA spots generally come from the POTA source and so on, there are a few
exceptions:</p>
<ol>
<li>Sources like GMA and Parks 'n' Peaks provide spots for multiple different programmes (activities).</li>
<li>Cluster spots may name activities in their comment, in which case the source remains the Cluster, but an
activity is assigned.
</li>
<li>Some activities, such as Worked all Britain (WAB), don't have their own spotting site and can <em>only</em>
be identified through comments on spots retrieved from other sources.
</li>
</ol>
<p>Spothole's web interface exists not just for the end user, but also as a reference implementation for the API, so
I have chosen to demonstrate both methods of filtering.</p>
<h4 class="mt-4">How is this better than DXheat, DXsummit, POTA's own website, etc?</h4>
<p>It's probably not? But it's nice to have choice.</p>
<p>I think it's got three key advantages over those sites:</p>
<ol>
<li>It provides a public, <a href="/apidocs">well-documented API</a> with an <a href="/apidocs/openapi.yml">OpenAPI
specification</a>. Other sites don't have official APIs or don't bother documenting them publicly, because
they want people to use their web page. I like Spothole's web page, but you don't have to use it&mdash;if
you're a programmer, you can build your own software on Spothole's API. Spothole does the hard work of
taking all the various data sources and providing a consistent, well-documented data set. You can then do
the fun bit of writing your own application.
</li>
<li>It grabs data from a lot more sources. I've seen other sites that pull in DX Cluster and POTA spots
together, but nothing on the scale of what Spothole supports.
</li>
<li>Spothole is open source, so anyone can contribute the code to support a new data source or add new features,
and share them with the community.
</li>
</ol>
<h4 class="mt-4">Why does this website ask me if I want to install it?</h4>
<p>Spothole is a Progressive Web App, which means you can install it on an Android or iOS device by opening the site
in Chrome or Safari respectively, and clicking "Install" on the pop-up panel. It'll only prompt you once, so if
you dismiss the prompt and change your mind, you'll find an Install / Add to Home Screen option on your
browser's menu.</p>
<p>Installing Spothole on your phone is completely optional, the website works exactly the same way as the "app"
does.</p>
<h4 class="mt-4">Why hasn't my spot/alert shown up yet?</h4>
<p>To avoid putting too much load on the various servers that Spothole connects to, the Spothole server only polls
them once every two minutes for spots, and once every 30 minutes for alerts. (Some sources, such as DX clusters,
RBN, APRS-IS and WWBOTA use a non-polling mechanism, and their updates will therefore arrive more quickly.) Then
if you are using the web interface, that has its own rate at which it fetches the data from Spothole. This is
instant for the main spots list, with new spots appearing immediately at the top of the list, while the map and
bands displays update once a minute, and the alerts display updates once every 5 minutes. So you could be
waiting around three minutes to see a newly added spot, or 40 minutes to see a newly added alert.</p>
<h4 class="mt-4">What licence does Spothole use?</h4>
<p>Spothole's source code is licenced under the Public Domain. You can write a Spothole client, run your own server,
modify it however you like, you can claim you wrote it and charge people £1000 for a copy, I don't really mind.
(Please don't do the last one. But if you're using my code for something cool, it would be nice to hear from
you!)</p>
<h4 class="mt-4">What commands are supported in the telnet server?</h4>
<p>Currently, <code>exit</code>, and nothing else. Support for some DXSpider-like commands may be added to Spothole
in due course, but at the moment if you want to add Spothole as a telnet cluster data source to your desktop
logging application, that application must handle filtering itself.</p>
{% end %}

Some files were not shown because too many files have changed in this diff Show More