PNP support

This commit is contained in:
Ian Renton
2025-09-27 11:46:06 +01:00
parent 172fba43c4
commit b1346e26ea
4 changed files with 68 additions and 9 deletions

View File

@@ -12,9 +12,21 @@ Currently supports:
* GMA * GMA
* HEMA * HEMA
* UKBOTA * UKBOTA
* Parks n Peaks
Future plans: Future plans:
* Parks n Peaks
* RBN * RBN
* APRS * APRS?
* Packet? * Packet?
Suggested names so far:
* All in 1 Spots
* All the Spots
* Spots Combiner 9000
* 927
* Activation Central
* DX Hub
* DX Aggregator
* Collect-o-Matic
* Spot-o-Tron
* Basic Universal Radio Program (BURP)

15
main.py
View File

@@ -4,6 +4,7 @@ import signal
from providers.dxcluster import DXCluster from providers.dxcluster import DXCluster
from providers.gma import GMA from providers.gma import GMA
from providers.hema import HEMA from providers.hema import HEMA
from providers.parksnpeaks import ParksNPeaks
from providers.pota import POTA from providers.pota import POTA
from providers.sota import SOTA from providers.sota import SOTA
from providers.wwbota import WWBOTA from providers.wwbota import WWBOTA
@@ -23,14 +24,14 @@ if __name__ == '__main__':
# Create providers # Create providers
providers = [ providers = [
# POTA(), POTA(),
# SOTA(), SOTA(),
# WWFF(), WWFF(),
# WWBOTA(), WWBOTA(),
# GMA(), GMA(),
HEMA(), HEMA(),
# todo PNP ParksNPeaks(),
# DXCluster("hrd.wa9pie.net", 8000), DXCluster("hrd.wa9pie.net", 8000),
# DXCluster("dxc.w3lpl.net", 22) # DXCluster("dxc.w3lpl.net", 22)
] ]
# Set up spot list # Set up spot list

45
providers/parksnpeaks.py Normal file
View File

@@ -0,0 +1,45 @@
from datetime import datetime
import pytz
from data.spot import Spot
from providers.http_provider import HTTPProvider
# Provider for Parks n Peaks
class ParksNPeaks(HTTPProvider):
POLL_INTERVAL_SEC = 120
SPOTS_URL = "https://www.parksnpeaks.org/api/ALL"
def __init__(self):
super().__init__(self.SPOTS_URL, self.POLL_INTERVAL_SEC)
def name(self):
return "ParksNPeaks"
def http_response_to_spots(self, http_response):
new_spots = []
# Iterate through source data
for source_spot in http_response.json():
print(source_spot)
# Convert to our spot format
spot = Spot(source=self.name(),
source_id=source_spot["actID"],
dx_call=source_spot["actCallsign"].upper(),
de_call=source_spot["actSpoter"].upper(), # typo exists in API
freq=float(source_spot["actFreq"]) * 1000,
mode=source_spot["actMode"].upper(),
comment=source_spot["actComments"],
sig=source_spot["actClass"],
sig_refs=[source_spot["actSiteID"]],
time=datetime.strptime(source_spot["actTime"], "%Y-%m-%d %H:%M:%S").replace(tzinfo=pytz.UTC))
# If this is POTA, SOTA or WWFF data we already have it through other means, so ignore.
if spot.sig not in ["POTA", "SOTA", "WWFF"]:
print("PNP spot found with sig " + spot.sig + ", developer needs to figure out how to look this up for grid/lat/lon!")
# Fill in any missing data
spot.infer_missing()
# Add to our list. Don't worry about de-duping, removing old spots etc. at this point; other code will do
# that for us.
new_spots.append(spot)
return new_spots

View File

@@ -5,6 +5,7 @@ from providers.http_provider import HTTPProvider
# Provider for Worldwide Bunkers on the Air # Provider for Worldwide Bunkers on the Air
# todo switch to event source API as per Steve change to Field Spotter
class WWBOTA(HTTPProvider): class WWBOTA(HTTPProvider):
POLL_INTERVAL_SEC = 120 POLL_INTERVAL_SEC = 120
SPOTS_URL = "https://api.wwbota.org/spots/" SPOTS_URL = "https://api.wwbota.org/spots/"