Compare commits
14 Commits
73-hamqth-
...
1.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf46017917 | ||
|
|
c30e1616d3 | ||
|
|
422c917073 | ||
|
|
cad1f5cfdf | ||
|
|
78f8cd26f0 | ||
|
|
d6cc2673dd | ||
|
|
8f553a59f8 | ||
|
|
f1841ca59e | ||
|
|
85e0a7354c | ||
|
|
2ccfa28119 | ||
|
|
b313735e28 | ||
|
|
bbaa3597f6 | ||
|
|
e61d7bedb4 | ||
|
|
ebf07f352f |
@@ -4,7 +4,7 @@ from data.sig import SIG
|
||||
|
||||
# General software
|
||||
SOFTWARE_NAME = "Spothole by M0TRT"
|
||||
SOFTWARE_VERSION = "0.1"
|
||||
SOFTWARE_VERSION = "1.0.1"
|
||||
|
||||
# HTTP headers used for spot providers that use HTTP
|
||||
HTTP_HEADERS = {"User-Agent": SOFTWARE_NAME + ", v" + SOFTWARE_VERSION + " (operated by " + SERVER_OWNER_CALLSIGN + ")"}
|
||||
|
||||
@@ -301,7 +301,7 @@ class LookupHelper:
|
||||
return ituz
|
||||
|
||||
# Infer an operator name from a callsign (requires QRZ.com/HamQTH)
|
||||
def infer_name_from_callsign(self, call):
|
||||
def infer_name_from_callsign_online_lookup(self, call):
|
||||
data = self.get_qrz_data_for_callsign(call)
|
||||
if data and "fname" in data:
|
||||
name = data["fname"]
|
||||
@@ -315,27 +315,40 @@ class LookupHelper:
|
||||
return None
|
||||
|
||||
# Infer a latitude and longitude from a callsign (requires QRZ.com/HamQTH)
|
||||
def infer_latlon_from_callsign_qrz(self, call):
|
||||
# Coordinates that look default are rejected (apologies if your position really is 0,0, enjoy your voyage)
|
||||
def infer_latlon_from_callsign_online_lookup(self, call):
|
||||
data = self.get_qrz_data_for_callsign(call)
|
||||
if data and "latitude" in data and "longitude" in data:
|
||||
if data and "latitude" in data and "longitude" in data and (data["latitude"] != 0 or data["longitude"] != 0):
|
||||
return [data["latitude"], data["longitude"]]
|
||||
data = self.get_hamqth_data_for_callsign(call)
|
||||
if data and "latitude" in data and "longitude" in data:
|
||||
if data and "latitude" in data and "longitude" in data and (data["latitude"] != 0 or data["longitude"] != 0):
|
||||
return [data["latitude"], data["longitude"]]
|
||||
else:
|
||||
return None
|
||||
|
||||
# Infer a grid locator from a callsign (requires QRZ.com/HamQTH)
|
||||
def infer_grid_from_callsign_qrz(self, call):
|
||||
# Infer a grid locator from a callsign (requires QRZ.com/HamQTH).
|
||||
# Grids that look default are rejected (apologies if your grid really is AA00aa, enjoy your research)
|
||||
def infer_grid_from_callsign_online_lookup(self, call):
|
||||
data = self.get_qrz_data_for_callsign(call)
|
||||
if data and "locator" in data:
|
||||
if data and "locator" in data and data["locator"].upper() != "AA00" and data["locator"].upper() != "AA00AA" and data["locator"].upper() != "AA00AA00":
|
||||
return data["locator"]
|
||||
data = self.get_hamqth_data_for_callsign(call)
|
||||
if data and "grid" in data:
|
||||
if data and "grid" in data and data["grid"].upper() != "AA00" and data["grid"].upper() != "AA00AA" and data["grid"].upper() != "AA00AA00":
|
||||
return data["grid"]
|
||||
else:
|
||||
return None
|
||||
|
||||
# Infer a textual QTH from a callsign (requires QRZ.com/HamQTH)
|
||||
def infer_qth_from_callsign_online_lookup(self, call):
|
||||
data = self.get_qrz_data_for_callsign(call)
|
||||
if data and "addr2" in data:
|
||||
return data["addr2"]
|
||||
data = self.get_hamqth_data_for_callsign(call)
|
||||
if data and "qth" in data:
|
||||
return data["qth"]
|
||||
else:
|
||||
return None
|
||||
|
||||
# Infer a latitude and longitude from a callsign (using DXCC, probably very inaccurate)
|
||||
def infer_latlon_from_callsign_dxcc(self, call):
|
||||
try:
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import csv
|
||||
import logging
|
||||
|
||||
from pyhamtools.locator import latlong_to_locator
|
||||
|
||||
@@ -28,89 +29,104 @@ def get_ref_regex_for_sig(sig):
|
||||
# Note there is currently no support for KRMNPA location lookup, see issue #61.
|
||||
def get_sig_ref_info(sig, sig_ref_id):
|
||||
sig_ref = SIGRef(id=sig_ref_id, sig=sig)
|
||||
if sig.upper() == "POTA":
|
||||
data = SEMI_STATIC_URL_DATA_CACHE.get("https://api.pota.app/park/" + sig_ref_id, headers=HTTP_HEADERS).json()
|
||||
if data:
|
||||
fullname = data["name"] if "name" in data else None
|
||||
if fullname and "parktypeDesc" in data and data["parktypeDesc"] != "":
|
||||
fullname = fullname + " " + data["parktypeDesc"]
|
||||
sig_ref.name = fullname
|
||||
sig_ref.url = "https://pota.app/#/park/" + sig_ref_id
|
||||
sig_ref.grid = data["grid6"] if "grid6" in data else None
|
||||
sig_ref.latitude = data["latitude"] if "latitude" in data else None
|
||||
sig_ref.longitude = data["longitude"] if "longitude" in data else None
|
||||
elif sig.upper() == "SOTA":
|
||||
data = SEMI_STATIC_URL_DATA_CACHE.get("https://api-db2.sota.org.uk/api/summits/" + sig_ref_id,
|
||||
headers=HTTP_HEADERS).json()
|
||||
if data:
|
||||
sig_ref.name = data["name"] if "name" in data else None
|
||||
sig_ref.url = "https://www.sotadata.org.uk/en/summit/" + sig_ref_id
|
||||
sig_ref.grid = data["locator"] if "locator" in data else None
|
||||
sig_ref.latitude = data["latitude"] if "latitude" in data else None
|
||||
sig_ref.longitude = data["longitude"] if "longitude" in data else None
|
||||
elif sig.upper() == "WWBOTA":
|
||||
data = SEMI_STATIC_URL_DATA_CACHE.get("https://api.wwbota.org/bunkers/" + sig_ref_id,
|
||||
headers=HTTP_HEADERS).json()
|
||||
if data:
|
||||
sig_ref.name = data["name"] if "name" in data else None
|
||||
sig_ref.url = "https://bunkerwiki.org/?s=" + sig_ref_id if sig_ref_id.startswith("B/G") else None
|
||||
sig_ref.grid = data["locator"] if "locator" in data else None
|
||||
sig_ref.latitude = data["lat"] if "lat" in data else None
|
||||
sig_ref.longitude = data["long"] if "long" in data else None
|
||||
elif sig.upper() == "GMA" or sig.upper() == "ARLHS" or sig.upper() == "ILLW" or sig.upper() == "WCA" or sig.upper() == "MOTA" or sig.upper() == "IOTA":
|
||||
data = SEMI_STATIC_URL_DATA_CACHE.get("https://www.cqgma.org/api/ref/?" + sig_ref_id,
|
||||
headers=HTTP_HEADERS).json()
|
||||
if data:
|
||||
sig_ref.name = data["name"] if "name" in data else None
|
||||
sig_ref.url = "https://www.cqgma.org/zinfo.php?ref=" + sig_ref_id
|
||||
sig_ref.grid = data["locator"] if "locator" in data else None
|
||||
sig_ref.latitude = data["latitude"] if "latitude" in data else None
|
||||
sig_ref.longitude = data["longitude"] if "longitude" in data else None
|
||||
elif sig.upper() == "WWFF":
|
||||
sig_ref.url = "https://wwff.co/directory/?showRef=" + sig_ref_id
|
||||
elif sig.upper() == "SIOTA":
|
||||
siota_csv_data = SEMI_STATIC_URL_DATA_CACHE.get("https://www.silosontheair.com/data/silos.csv",
|
||||
headers=HTTP_HEADERS)
|
||||
siota_dr = csv.DictReader(siota_csv_data.content.decode().splitlines())
|
||||
for row in siota_dr:
|
||||
if row["SILO_CODE"] == sig_ref_id:
|
||||
sig_ref.name = row["NAME"] if "NAME" in row else None
|
||||
sig_ref.grid = row["LOCATOR"] if "LOCATOR" in row else None
|
||||
sig_ref.latitude = float(row["LAT"]) if "LAT" in row else None
|
||||
sig_ref.longitude = float(row["LNG"]) if "LNG" in row else None
|
||||
elif sig.upper() == "WOTA":
|
||||
data = SEMI_STATIC_URL_DATA_CACHE.get("https://www.wota.org.uk/mapping/data/summits.json",
|
||||
headers=HTTP_HEADERS).json()
|
||||
if data:
|
||||
for feature in data["features"]:
|
||||
if feature["properties"]["wotaId"] == sig_ref_id:
|
||||
sig_ref.name = feature["properties"]["title"]
|
||||
sig_ref.url = "https://www.wota.org.uk/MM_" + sig_ref_id
|
||||
sig_ref.grid = feature["properties"]["qthLocator"]
|
||||
sig_ref.latitude = feature["geometry"]["coordinates"][1]
|
||||
sig_ref.longitude = feature["geometry"]["coordinates"][0]
|
||||
elif sig.upper() == "ZLOTA":
|
||||
data = SEMI_STATIC_URL_DATA_CACHE.get("https://ontheair.nz/assets/assets.json", headers=HTTP_HEADERS).json()
|
||||
if data:
|
||||
for asset in data:
|
||||
if asset["code"] == sig_ref_id:
|
||||
sig_ref.name = asset["name"]
|
||||
sig_ref.url = "https://ontheair.nz/assets/ZLI_OT-030" + sig_ref_id.replace("/", "_")
|
||||
sig_ref.grid = latlong_to_locator(asset["y"], asset["x"], 6)
|
||||
sig_ref.latitude = asset["y"]
|
||||
sig_ref.longitude = asset["x"]
|
||||
elif sig.upper() == "BOTA":
|
||||
if not sig_ref.name:
|
||||
sig_ref.name = sig_ref.id
|
||||
sig_ref.url = "https://www.beachesontheair.com/beaches/" + sig_ref.name.lower().replace(" ", "-")
|
||||
elif sig.upper() == "WAB" or sig.upper() == "WAI":
|
||||
ll = wab_wai_square_to_lat_lon(sig_ref_id)
|
||||
if ll:
|
||||
sig_ref.name = sig_ref_id
|
||||
sig_ref.grid = latlong_to_locator(ll[0], ll[1], 6)
|
||||
sig_ref.latitude = ll[0]
|
||||
sig_ref.longitude = ll[1]
|
||||
|
||||
try:
|
||||
if sig.upper() == "POTA":
|
||||
data = SEMI_STATIC_URL_DATA_CACHE.get("https://api.pota.app/park/" + sig_ref_id, headers=HTTP_HEADERS).json()
|
||||
if data:
|
||||
fullname = data["name"] if "name" in data else None
|
||||
if fullname and "parktypeDesc" in data and data["parktypeDesc"] != "":
|
||||
fullname = fullname + " " + data["parktypeDesc"]
|
||||
sig_ref.name = fullname
|
||||
sig_ref.url = "https://pota.app/#/park/" + sig_ref_id
|
||||
sig_ref.grid = data["grid6"] if "grid6" in data else None
|
||||
sig_ref.latitude = data["latitude"] if "latitude" in data else None
|
||||
sig_ref.longitude = data["longitude"] if "longitude" in data else None
|
||||
elif sig.upper() == "SOTA":
|
||||
data = SEMI_STATIC_URL_DATA_CACHE.get("https://api-db2.sota.org.uk/api/summits/" + sig_ref_id,
|
||||
headers=HTTP_HEADERS).json()
|
||||
if data:
|
||||
sig_ref.name = data["name"] if "name" in data else None
|
||||
sig_ref.url = "https://www.sotadata.org.uk/en/summit/" + sig_ref_id
|
||||
sig_ref.grid = data["locator"] if "locator" in data else None
|
||||
sig_ref.latitude = data["latitude"] if "latitude" in data else None
|
||||
sig_ref.longitude = data["longitude"] if "longitude" in data else None
|
||||
elif sig.upper() == "WWBOTA":
|
||||
data = SEMI_STATIC_URL_DATA_CACHE.get("https://api.wwbota.org/bunkers/" + sig_ref_id,
|
||||
headers=HTTP_HEADERS).json()
|
||||
if data:
|
||||
sig_ref.name = data["name"] if "name" in data else None
|
||||
sig_ref.url = "https://bunkerwiki.org/?s=" + sig_ref_id if sig_ref_id.startswith("B/G") else None
|
||||
sig_ref.grid = data["locator"] if "locator" in data else None
|
||||
sig_ref.latitude = data["lat"] if "lat" in data else None
|
||||
sig_ref.longitude = data["long"] if "long" in data else None
|
||||
elif sig.upper() == "GMA" or sig.upper() == "ARLHS" or sig.upper() == "ILLW" or sig.upper() == "WCA" or sig.upper() == "MOTA" or sig.upper() == "IOTA":
|
||||
data = SEMI_STATIC_URL_DATA_CACHE.get("https://www.cqgma.org/api/ref/?" + sig_ref_id,
|
||||
headers=HTTP_HEADERS).json()
|
||||
if data:
|
||||
sig_ref.name = data["name"] if "name" in data else None
|
||||
sig_ref.url = "https://www.cqgma.org/zinfo.php?ref=" + sig_ref_id
|
||||
sig_ref.grid = data["locator"] if "locator" in data else None
|
||||
sig_ref.latitude = data["latitude"] if "latitude" in data else None
|
||||
sig_ref.longitude = data["longitude"] if "longitude" in data else None
|
||||
elif sig.upper() == "WWFF":
|
||||
wwff_csv_data = SEMI_STATIC_URL_DATA_CACHE.get("https://wwff.co/wwff-data/wwff_directory.csv",
|
||||
headers=HTTP_HEADERS)
|
||||
wwff_dr = csv.DictReader(wwff_csv_data.content.decode().splitlines())
|
||||
for row in wwff_dr:
|
||||
if row["reference"] == sig_ref_id:
|
||||
sig_ref.name = row["name"] if "name" in row else None
|
||||
sig_ref.url = "https://wwff.co/directory/?showRef=" + sig_ref_id
|
||||
sig_ref.grid = row["iaruLocator"] if "iaruLocator" in row else None
|
||||
sig_ref.latitude = float(row["latitude"]) if "latitude" in row else None
|
||||
sig_ref.longitude = float(row["longitude"]) if "longitude" in row else None
|
||||
break
|
||||
elif sig.upper() == "SIOTA":
|
||||
siota_csv_data = SEMI_STATIC_URL_DATA_CACHE.get("https://www.silosontheair.com/data/silos.csv",
|
||||
headers=HTTP_HEADERS)
|
||||
siota_dr = csv.DictReader(siota_csv_data.content.decode().splitlines())
|
||||
for row in siota_dr:
|
||||
if row["SILO_CODE"] == sig_ref_id:
|
||||
sig_ref.name = row["NAME"] if "NAME" in row else None
|
||||
sig_ref.grid = row["LOCATOR"] if "LOCATOR" in row else None
|
||||
sig_ref.latitude = float(row["LAT"]) if "LAT" in row else None
|
||||
sig_ref.longitude = float(row["LNG"]) if "LNG" in row else None
|
||||
break
|
||||
elif sig.upper() == "WOTA":
|
||||
data = SEMI_STATIC_URL_DATA_CACHE.get("https://www.wota.org.uk/mapping/data/summits.json",
|
||||
headers=HTTP_HEADERS).json()
|
||||
if data:
|
||||
for feature in data["features"]:
|
||||
if feature["properties"]["wotaId"] == sig_ref_id:
|
||||
sig_ref.name = feature["properties"]["title"]
|
||||
sig_ref.url = "https://www.wota.org.uk/MM_" + sig_ref_id
|
||||
sig_ref.grid = feature["properties"]["qthLocator"]
|
||||
sig_ref.latitude = feature["geometry"]["coordinates"][1]
|
||||
sig_ref.longitude = feature["geometry"]["coordinates"][0]
|
||||
break
|
||||
elif sig.upper() == "ZLOTA":
|
||||
data = SEMI_STATIC_URL_DATA_CACHE.get("https://ontheair.nz/assets/assets.json", headers=HTTP_HEADERS).json()
|
||||
if data:
|
||||
for asset in data:
|
||||
if asset["code"] == sig_ref_id:
|
||||
sig_ref.name = asset["name"]
|
||||
sig_ref.url = "https://ontheair.nz/assets/ZLI_OT-030" + sig_ref_id.replace("/", "_")
|
||||
sig_ref.grid = latlong_to_locator(asset["y"], asset["x"], 6)
|
||||
sig_ref.latitude = asset["y"]
|
||||
sig_ref.longitude = asset["x"]
|
||||
break
|
||||
elif sig.upper() == "BOTA":
|
||||
if not sig_ref.name:
|
||||
sig_ref.name = sig_ref.id
|
||||
sig_ref.url = "https://www.beachesontheair.com/beaches/" + sig_ref.name.lower().replace(" ", "-")
|
||||
elif sig.upper() == "WAB" or sig.upper() == "WAI":
|
||||
ll = wab_wai_square_to_lat_lon(sig_ref_id)
|
||||
if ll:
|
||||
sig_ref.name = sig_ref_id
|
||||
sig_ref.grid = latlong_to_locator(ll[0], ll[1], 6)
|
||||
sig_ref.latitude = ll[0]
|
||||
sig_ref.longitude = ll[1]
|
||||
except:
|
||||
logging.warn("Failed to look up sig_ref info for " + sig + " ref " + sig_ref_id + ".")
|
||||
return sig_ref
|
||||
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ class Alert:
|
||||
# the actual alertting service, e.g. we don't want to accidentally use a user's QRZ.com home lat/lon instead of
|
||||
# the one from the park reference they're at.
|
||||
if self.dx_calls and not self.dx_names:
|
||||
self.dx_names = list(map(lambda c: lookup_helper.infer_name_from_callsign(c), self.dx_calls))
|
||||
self.dx_names = list(map(lambda c: lookup_helper.infer_name_from_callsign_online_lookup(c), self.dx_calls))
|
||||
|
||||
# Always create an ID based on a hash of every parameter *except* received_time. This is used as the index
|
||||
# to a map, which as a byproduct avoids us having multiple duplicate copies of the object that are identical
|
||||
|
||||
22
data/spot.py
@@ -27,6 +27,9 @@ class Spot:
|
||||
dx_call: str = None
|
||||
# Name of the operator that has been spotted
|
||||
dx_name: str = None
|
||||
# QTH of the operator that has been spotted. This could be from any SIG refs or could be from online lookup of their
|
||||
# home QTH.
|
||||
dx_qth: str = None
|
||||
# Country of the DX operator
|
||||
dx_country: str = None
|
||||
# Country flag of the DX operator
|
||||
@@ -313,15 +316,24 @@ class Spot:
|
||||
# the actual spotting service, e.g. we don't want to accidentally use a user's QRZ.com home lat/lon instead of
|
||||
# the one from the park reference they're at.
|
||||
if self.dx_call and not self.dx_name:
|
||||
self.dx_name = lookup_helper.infer_name_from_callsign(self.dx_call)
|
||||
self.dx_name = lookup_helper.infer_name_from_callsign_online_lookup(self.dx_call)
|
||||
if self.dx_call and not self.dx_latitude:
|
||||
latlon = lookup_helper.infer_latlon_from_callsign_qrz(self.dx_call)
|
||||
latlon = lookup_helper.infer_latlon_from_callsign_online_lookup(self.dx_call)
|
||||
if latlon:
|
||||
self.dx_latitude = latlon[0]
|
||||
self.dx_longitude = latlon[1]
|
||||
self.dx_grid = lookup_helper.infer_grid_from_callsign_qrz(self.dx_call)
|
||||
self.dx_grid = lookup_helper.infer_grid_from_callsign_online_lookup(self.dx_call)
|
||||
self.dx_location_source = "HOME QTH"
|
||||
|
||||
# Determine a "QTH" string. If we have a SIG ref, pick the first one and turn it into a suitable stirng,
|
||||
# otherwise see what they have set on an online lookup service.
|
||||
if self.sig_refs and len(self.sig_refs) > 0:
|
||||
self.dx_qth = self.sig_refs[0].id
|
||||
if self.sig_refs[0].name:
|
||||
self.dx_qth = self.dx_qth + " " + self.sig_refs[0].name
|
||||
else:
|
||||
self.dx_qth = lookup_helper.infer_qth_from_callsign_online_lookup(self.dx_call)
|
||||
|
||||
# Last resort for getting a DX position, use the DXCC entity.
|
||||
if self.dx_call and not self.dx_latitude:
|
||||
latlon = lookup_helper.infer_latlon_from_callsign_dxcc(self.dx_call)
|
||||
@@ -341,11 +353,11 @@ class Spot:
|
||||
if self.de_call and any(char.isdigit() for char in self.de_call) and not (self.de_call.startswith("T2") and self.source == "APRS-IS"):
|
||||
# DE operator position lookup, using QRZ.com.
|
||||
if not self.de_latitude:
|
||||
latlon = lookup_helper.infer_latlon_from_callsign_qrz(self.de_call)
|
||||
latlon = lookup_helper.infer_latlon_from_callsign_online_lookup(self.de_call)
|
||||
if latlon:
|
||||
self.de_latitude = latlon[0]
|
||||
self.de_longitude = latlon[1]
|
||||
self.de_grid = lookup_helper.infer_grid_from_callsign_qrz(self.de_call)
|
||||
self.de_grid = lookup_helper.infer_grid_from_callsign_online_lookup(self.de_call)
|
||||
|
||||
# Last resort for getting a DE position, use the DXCC entity.
|
||||
if not self.de_latitude:
|
||||
|
||||
@@ -127,6 +127,7 @@ class WebServer:
|
||||
return self.serve_api({
|
||||
"call": call,
|
||||
"name": fake_spot.dx_name,
|
||||
"qth": fake_spot.dx_qth,
|
||||
"country": fake_spot.dx_country,
|
||||
"flag": fake_spot.dx_flag,
|
||||
"continent": fake_spot.dx_continent,
|
||||
|
||||
@@ -5,7 +5,6 @@ import pytz
|
||||
|
||||
from core.cache_utils import SEMI_STATIC_URL_DATA_CACHE
|
||||
from core.constants import HTTP_HEADERS
|
||||
from core.sig_utils import get_icon_for_sig
|
||||
from data.sig_ref import SIGRef
|
||||
from data.spot import Spot
|
||||
from spotproviders.http_spot_provider import HTTPSpotProvider
|
||||
@@ -51,7 +50,7 @@ class GMA(HTTPSpotProvider):
|
||||
# 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 ref_info["reftype"] not in ["POTA", "WWFF"] and (ref_info["reftype"] != "Summit" or ref_info["sota"] == ""):
|
||||
if "reftype" in ref_info and ref_info["reftype"] not in ["POTA", "WWFF"] and (ref_info["reftype"] != "Summit" or ref_info["sota"] == ""):
|
||||
match ref_info["reftype"]:
|
||||
case "Summit":
|
||||
spot.sig_refs[0].sig = "GMA"
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import logging
|
||||
import re
|
||||
from datetime import datetime
|
||||
|
||||
import pytz
|
||||
from rss_parser import RSSParser
|
||||
|
||||
from core.sig_utils import get_icon_for_sig
|
||||
from data.sig_ref import SIGRef
|
||||
from data.spot import Spot
|
||||
from spotproviders.http_spot_provider import HTTPSpotProvider
|
||||
@@ -12,7 +13,7 @@ from spotproviders.http_spot_provider import HTTPSpotProvider
|
||||
# Spot provider for Wainwrights on the Air
|
||||
class WOTA(HTTPSpotProvider):
|
||||
POLL_INTERVAL_SEC = 120
|
||||
SPOTS_URL = "https://www.wota.org.uk/spots_rss.php"
|
||||
SPOTS_URL = "http://127.0.0.1:8000/spots_rss.php"
|
||||
LIST_URL = "https://www.wota.org.uk/mapping/data/summits.json"
|
||||
RSS_DATE_TIME_FORMAT = "%a, %d %b %Y %H:%M:%S %z"
|
||||
|
||||
@@ -25,47 +26,50 @@ class WOTA(HTTPSpotProvider):
|
||||
# Iterate through source data
|
||||
for source_spot in rss.channel.items:
|
||||
|
||||
# Reject GUID missing or zero
|
||||
if not source_spot.guid or not source_spot.guid.content or source_spot.guid.content == "http://www.wota.org.uk/spots/0":
|
||||
continue
|
||||
try:
|
||||
# Reject GUID missing or zero
|
||||
if not source_spot.guid or not source_spot.guid.content or source_spot.guid.content == "http://www.wota.org.uk/spots/0":
|
||||
continue
|
||||
|
||||
# Pick apart the title
|
||||
title_split = source_spot.title.split(" on ")
|
||||
dx_call = title_split[0]
|
||||
ref = None
|
||||
ref_name = None
|
||||
if len(title_split) > 1:
|
||||
ref_split = title_split[1].split(" - ")
|
||||
ref = ref_split[0]
|
||||
if len(ref_split) > 1:
|
||||
ref_name = ref_split[1]
|
||||
# Pick apart the title
|
||||
title_split = source_spot.title.split(" on ")
|
||||
dx_call = title_split[0]
|
||||
ref = None
|
||||
ref_name = None
|
||||
if len(title_split) > 1:
|
||||
ref_split = title_split[1].split(" - ")
|
||||
ref = ref_split[0]
|
||||
if len(ref_split) > 1:
|
||||
ref_name = ref_split[1]
|
||||
|
||||
# Pick apart the description
|
||||
desc_split = source_spot.description.split(". ")
|
||||
freq_mode = desc_split[0].replace("Frequencies/modes:", "").strip()
|
||||
freq_mode_split = freq_mode.split("-")
|
||||
freq_hz = float(freq_mode_split[0]) * 1000000
|
||||
mode = freq_mode_split[1]
|
||||
# Pick apart the description
|
||||
desc_split = source_spot.description.split(". ")
|
||||
freq_mode = desc_split[0].replace("Frequencies/modes:", "").strip()
|
||||
freq_mode_split = re.split(r'[\-\s]+', freq_mode)
|
||||
freq_hz = float(freq_mode_split[0]) * 1000000
|
||||
mode = freq_mode_split[1].upper()
|
||||
|
||||
comment = None
|
||||
if len(desc_split) > 1:
|
||||
comment = desc_split[1].strip()
|
||||
spotter = None
|
||||
if len(desc_split) > 2:
|
||||
spotter = desc_split[2].replace("Spotted by ", "").replace(".", "").strip()
|
||||
comment = None
|
||||
if len(desc_split) > 1:
|
||||
comment = desc_split[1].strip()
|
||||
spotter = None
|
||||
if len(desc_split) > 2:
|
||||
spotter = desc_split[2].replace("Spotted by ", "").replace(".", "").upper().strip()
|
||||
|
||||
time = datetime.strptime(source_spot.pub_date.content, self.RSS_DATE_TIME_FORMAT).astimezone(pytz.UTC)
|
||||
time = datetime.strptime(source_spot.pub_date.content, self.RSS_DATE_TIME_FORMAT).astimezone(pytz.UTC)
|
||||
|
||||
# Convert to our spot format
|
||||
spot = Spot(source=self.name,
|
||||
source_id=source_spot.guid.content,
|
||||
dx_call=dx_call,
|
||||
de_call=spotter,
|
||||
freq=freq_hz,
|
||||
mode=mode,
|
||||
comment=comment,
|
||||
sig_refs=[SIGRef(id=ref, sig="WOTA", name=ref_name)] if ref else [],
|
||||
time=time.timestamp())
|
||||
# Convert to our spot format
|
||||
spot = Spot(source=self.name,
|
||||
source_id=source_spot.guid.content,
|
||||
dx_call=dx_call,
|
||||
de_call=spotter,
|
||||
freq=freq_hz,
|
||||
mode=mode,
|
||||
comment=comment,
|
||||
sig_refs=[SIGRef(id=ref, sig="WOTA", name=ref_name)] if ref else [],
|
||||
time=time.timestamp())
|
||||
|
||||
new_spots.append(spot)
|
||||
new_spots.append(spot)
|
||||
except Exception as e:
|
||||
logging.error("Exception parsing WOTA spot", e)
|
||||
return new_spots
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
<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 hour 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 reloads the data from Spothole, which is once a minute for spots or 30 minutes for alerts. So you could be waiting around three minutes to see a newly added spot, or 90 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>
|
||||
<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>
|
||||
<h2 id="privacy" class="mt-4">Privacy</h2>
|
||||
<p>Spothole collects no data about you, and there is no way to enter personally identifying information into the site apart from by spotting and alerting through Spothole or the various services it connects to. 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>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<p class="d-inline-flex gap-1">
|
||||
<span style="position: relative;">
|
||||
<i class="fa-solid fa-magnifying-glass" style="position: absolute; left: 0px; top: 2px; padding: 10px; pointer-events: none;"></i>
|
||||
<input id="filter-dx-call" type="text" class="form-control" oninput="filtersUpdated();" placeholder="Search for call">
|
||||
<input id="filter-dx-call" type="search" class="form-control" oninput="filtersUpdated();" placeholder="Callsign">
|
||||
</span>
|
||||
<button id="filters-button" type="button" class="btn btn-outline-primary" data-bs-toggle="button" onclick="toggleFiltersPanel();"><i class="fa-solid fa-filter"></i> Filters</button>
|
||||
<button id="display-button" type="button" class="btn btn-outline-primary" data-bs-toggle="button" onclick="toggleDisplayPanel();"><i class="fa-solid fa-desktop"></i> Display</button>
|
||||
|
||||
@@ -5,6 +5,10 @@ info:
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
contact:
|
||||
email: ian@ianrenton.com
|
||||
license:
|
||||
@@ -518,13 +522,17 @@ paths:
|
||||
type: string
|
||||
description: Name of the operator
|
||||
example: Ian
|
||||
qth:
|
||||
type: string
|
||||
description: QTH of the operator. This could be from any SIG refs or could be from online lookup of their home QTH.
|
||||
example: Dorset
|
||||
country:
|
||||
type: string
|
||||
description: Country of the operator
|
||||
example: United Kingdom
|
||||
description: Country of the operator. Note that this is named "country" for commonality with other amateur radio tools, but in reality this is more of a "DXCC Name", as it includes many options which are not countries, just territories that DXCC uniquely identifies.
|
||||
example: England
|
||||
flag:
|
||||
type: string
|
||||
description: Country flag of the operator
|
||||
description: Country flag of the operator. This is limited to the range of emoji flags. For some DXCCs there may not be an official emoji flag, e.g. Northern Ireland, so the appearance may vary depending on your browser and operating system. Some small islands may also have no flag. Many DXCCs may also share a flag, e.g. mainland Spain, Balearic Islands, etc.
|
||||
example: ""
|
||||
continent:
|
||||
type: string
|
||||
@@ -745,13 +753,17 @@ components:
|
||||
type: string
|
||||
description: Name of the operator that has been spotted
|
||||
example: Ian
|
||||
dx_qth:
|
||||
type: string
|
||||
description: QTH of the operator that has been spotted. This could be from any SIG refs or could be from online lookup of their home QTH.
|
||||
example: Dorset
|
||||
dx_country:
|
||||
type: string
|
||||
description: Country of the DX operator
|
||||
example: United Kingdom
|
||||
description: Country of the operator. Note that this is named "country" for commonality with other amateur radio tools, but in reality this is more of a "DXCC Name", as it includes many options which are not countries, just territories that DXCC uniquely identifies.
|
||||
example: England
|
||||
dx_flag:
|
||||
type: string
|
||||
description: Country flag of the DX operator
|
||||
description: Country flag of the DX operator. This is limited to the range of emoji flags. For some DXCCs there may not be an official emoji flag, e.g. Northern Ireland, so the appearance may vary depending on your browser and operating system. Some small islands may also have no flag. Many DXCCs may also share a flag, e.g. mainland Spain, Balearic Islands, etc.
|
||||
example: ""
|
||||
dx_continent:
|
||||
type: string
|
||||
@@ -814,11 +826,11 @@ components:
|
||||
example: M0TEST
|
||||
de_country:
|
||||
type: string
|
||||
description: Country of the spotter
|
||||
example: United Kingdom
|
||||
description: Country of the operator. Note that this is named "country" for commonality with other amateur radio tools, but in reality this is more of a "DXCC Name", as it includes many options which are not countries, just territories that DXCC uniquely identifies.
|
||||
example: England
|
||||
de_flag:
|
||||
type: string
|
||||
description: Country flag of the spotter
|
||||
description: Country flag of the spotter. This is limited to the range of emoji flags. For some DXCCs there may not be an official emoji flag, e.g. Northern Ireland, so the appearance may vary depending on your browser and operating system. Some small islands may also have no flag. Many DXCCs may also share a flag, e.g. mainland Spain, Balearic Islands, etc.
|
||||
example: ""
|
||||
de_continent:
|
||||
type: string
|
||||
@@ -1038,11 +1050,11 @@ components:
|
||||
example: Ian
|
||||
dx_country:
|
||||
type: string
|
||||
description: Country of the DX operator. This, and the subsequent fields, assume that all activators will be in the same country!
|
||||
example: United Kingdom
|
||||
description: Country of the DX operator. Country of the operator. Note that this is named "country" for commonality with other amateur radio tools, but in reality this is more of a "DXCC Name", as it includes many options which are not countries, just territories that DXCC uniquely identifies. This, and the subsequent fields, assume that all activators will be in the same country!
|
||||
example: England
|
||||
dx_flag:
|
||||
type: string
|
||||
description: Country flag of the DX operator
|
||||
description: Country flag of the DX operator. This is limited to the range of emoji flags. For some DXCCs there may not be an official emoji flag, e.g. Northern Ireland, so the appearance may vary depending on your browser and operating system. Some small islands may also have no flag. Many DXCCs may also share a flag, e.g. mainland Spain, Balearic Islands, etc.
|
||||
example: ""
|
||||
dx_continent:
|
||||
type: string
|
||||
|
||||
@@ -44,7 +44,7 @@ div.container {
|
||||
/* SPOTS/ALERTS PAGES, SETTINGS/STATUS AREAS */
|
||||
|
||||
input#filter-dx-call {
|
||||
max-width: 10em;
|
||||
max-width: 12em;
|
||||
margin-right: 1rem;
|
||||
padding-left: 2em;
|
||||
}
|
||||
@@ -71,11 +71,16 @@ td.nowrap, span.nowrap {
|
||||
|
||||
span.flag-wrapper {
|
||||
display: inline-block;
|
||||
width: 1.7em;
|
||||
width: 1.8em;
|
||||
text-align: center;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
img.flag {
|
||||
position: relative;
|
||||
top: -2px;
|
||||
}
|
||||
|
||||
span.band-bullet {
|
||||
display: inline-block;
|
||||
cursor: default;
|
||||
@@ -265,7 +270,7 @@ div.band-spot:hover span.band-spot-info {
|
||||
}
|
||||
/* Filter/search DX Call field should be smaller on mobile */
|
||||
input#filter-dx-call {
|
||||
max-width: 6em;
|
||||
max-width: 9em;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
BIN
webassets/img/flags/1.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
webassets/img/flags/10.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
webassets/img/flags/100.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
webassets/img/flags/101.png
Normal file
|
After Width: | Height: | Size: 348 B |
BIN
webassets/img/flags/102.png
Normal file
|
After Width: | Height: | Size: 348 B |
BIN
webassets/img/flags/103.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
webassets/img/flags/104.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
webassets/img/flags/105.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
webassets/img/flags/106.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
webassets/img/flags/107.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
webassets/img/flags/108.png
Normal file
|
After Width: | Height: | Size: 8.7 KiB |
BIN
webassets/img/flags/109.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
webassets/img/flags/11.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
webassets/img/flags/110.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
webassets/img/flags/111.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
webassets/img/flags/112.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
webassets/img/flags/113.png
Normal file
|
After Width: | Height: | Size: 348 B |
BIN
webassets/img/flags/114.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
webassets/img/flags/115.png
Normal file
|
After Width: | Height: | Size: 348 B |
BIN
webassets/img/flags/116.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
webassets/img/flags/117.png
Normal file
|
After Width: | Height: | Size: 9.5 KiB |
BIN
webassets/img/flags/118.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
webassets/img/flags/119.png
Normal file
|
After Width: | Height: | Size: 348 B |
BIN
webassets/img/flags/12.png
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
BIN
webassets/img/flags/120.png
Normal file
|
After Width: | Height: | Size: 8.2 KiB |
BIN
webassets/img/flags/122.png
Normal file
|
After Width: | Height: | Size: 8.9 KiB |
BIN
webassets/img/flags/123.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
webassets/img/flags/124.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
webassets/img/flags/125.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
webassets/img/flags/126.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
webassets/img/flags/127.png
Normal file
|
After Width: | Height: | Size: 348 B |
BIN
webassets/img/flags/128.png
Normal file
|
After Width: | Height: | Size: 348 B |
BIN
webassets/img/flags/129.png
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
webassets/img/flags/13.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
webassets/img/flags/130.png
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
BIN
webassets/img/flags/131.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
webassets/img/flags/132.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
webassets/img/flags/133.png
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
webassets/img/flags/134.png
Normal file
|
After Width: | Height: | Size: 348 B |
BIN
webassets/img/flags/135.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
webassets/img/flags/136.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
webassets/img/flags/137.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
webassets/img/flags/138.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
webassets/img/flags/139.png
Normal file
|
After Width: | Height: | Size: 348 B |
BIN
webassets/img/flags/14.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
webassets/img/flags/140.png
Normal file
|
After Width: | Height: | Size: 7.4 KiB |
BIN
webassets/img/flags/141.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
webassets/img/flags/142.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
webassets/img/flags/143.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
webassets/img/flags/144.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
webassets/img/flags/145.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
webassets/img/flags/146.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
webassets/img/flags/147.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
webassets/img/flags/148.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
webassets/img/flags/149.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
webassets/img/flags/15.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
webassets/img/flags/150.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
webassets/img/flags/151.png
Normal file
|
After Width: | Height: | Size: 348 B |
BIN
webassets/img/flags/152.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
webassets/img/flags/153.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
webassets/img/flags/154.png
Normal file
|
After Width: | Height: | Size: 348 B |
BIN
webassets/img/flags/155.png
Normal file
|
After Width: | Height: | Size: 348 B |
BIN
webassets/img/flags/157.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
webassets/img/flags/158.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
webassets/img/flags/159.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
webassets/img/flags/16.png
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
webassets/img/flags/160.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
webassets/img/flags/161.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
webassets/img/flags/162.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
webassets/img/flags/163.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
webassets/img/flags/164.png
Normal file
|
After Width: | Height: | Size: 348 B |
BIN
webassets/img/flags/165.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
webassets/img/flags/166.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
webassets/img/flags/167.png
Normal file
|
After Width: | Height: | Size: 348 B |
BIN
webassets/img/flags/168.png
Normal file
|
After Width: | Height: | Size: 8.9 KiB |
BIN
webassets/img/flags/169.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
webassets/img/flags/17.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
webassets/img/flags/170.png
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
webassets/img/flags/171.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
webassets/img/flags/172.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
webassets/img/flags/173.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
webassets/img/flags/174.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
webassets/img/flags/175.png
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
webassets/img/flags/176.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
webassets/img/flags/177.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
webassets/img/flags/178.png
Normal file
|
After Width: | Height: | Size: 348 B |
BIN
webassets/img/flags/179.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
webassets/img/flags/18.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |