Refactor activity names to use an enum instead of a string to avoid typos #147

This commit is contained in:
Ian Renton
2026-09-18 18:09:41 +01:00
parent ab79e7e01c
commit e5caf7353d
61 changed files with 735 additions and 638 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import csv
from time import sleep
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import (
FileDownloadActivityRefDataProvider,
@@ -12,7 +12,7 @@ class ARLHS(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Amateur Radio Light House Society"""
POLL_INTERVAL_DAYS = 30
ACTIVITY = "ARLHS"
ACTIVITY = ActivityName.ARLHS
DATA_URL = "https://www.gma.rocks/download/lighthouse.csv"
def __init__(self, provider_config):
+2 -2
View File
@@ -2,7 +2,7 @@ from time import sleep
from pyhamtools.locator import latlong_to_locator
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import FileDownloadActivityRefDataProvider
@@ -11,7 +11,7 @@ class COTA(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Castles on the Air"""
POLL_INTERVAL_DAYS = 30
ACTIVITY = "COTA"
ACTIVITY = ActivityName.COTA
DATA_URL = "https://www.cotagroup.org/cotagroup/map/data/castles-all-7d90ee2a5e1175e5dece1bbf9dc87504.json"
def __init__(self, provider_config):
+2 -2
View File
@@ -3,7 +3,7 @@ from time import sleep
import pandas as pd
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import FileDownloadActivityRefDataProvider
@@ -12,7 +12,7 @@ class DCE(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Diploma Castillos de España"""
POLL_INTERVAL_DAYS = 365
ACTIVITY = "DCE"
ACTIVITY = ActivityName.DCE
DATA_URL = "https://www.acracb.org/dce/descargas/General/directorio_referencias_dce.xls"
def __init__(self, provider_config):
+2 -2
View File
@@ -3,7 +3,7 @@ from time import sleep
import pandas as pd
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import FileDownloadActivityRefDataProvider
@@ -12,7 +12,7 @@ class DEFE(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Diploma Estationes de Ferrocarril de España"""
POLL_INTERVAL_DAYS = 365
ACTIVITY = "DEFE"
ACTIVITY = ActivityName.DEFE
DATA_URL = "https://www.acracb.org/defe/descargas/General/directorio_referencias_defe.xls"
def __init__(self, provider_config):
+2 -2
View File
@@ -3,7 +3,7 @@ from time import sleep
from pyhamtools.locator import latlong_to_locator
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.local_file_activity_ref_data_provider import (
LocalFileActivityRefDataProvider,
@@ -13,7 +13,7 @@ from providers.activityrefdata.local_file_activity_ref_data_provider import (
class DME(LocalFileActivityRefDataProvider):
"""Activity ref data provider for Diploma Municipios de Espana"""
ACTIVITY = "DME"
ACTIVITY = ActivityName.DME
PATH = "datafiles/MUNICIPIOS.csv"
def __init__(self, provider_config):
+2 -2
View File
@@ -1,7 +1,7 @@
import csv
from time import sleep
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import FileDownloadActivityRefDataProvider
@@ -10,7 +10,7 @@ class DMUE(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Diploma Museos de España"""
POLL_INTERVAL_DAYS = 365
ACTIVITY = "DMUE"
ACTIVITY = ActivityName.DMUE
DATA_URL = "https://dmue.radiogalena.es/nom_dmue.csv"
def __init__(self, provider_config):
+2 -2
View File
@@ -3,7 +3,7 @@ from time import sleep
import pandas as pd
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import FileDownloadActivityRefDataProvider
@@ -12,7 +12,7 @@ class DMVE(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Diploma Monumentos y Vestigios de España"""
POLL_INTERVAL_DAYS = 365
ACTIVITY = "DMVE"
ACTIVITY = ActivityName.DMVE
DATA_URL = "https://www.acracb.org/dmve/descargas/General/directorio_referencias_dmve.xls"
def __init__(self, provider_config):
+2 -2
View File
@@ -1,6 +1,6 @@
from time import sleep
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import FileDownloadActivityRefDataProvider
@@ -9,7 +9,7 @@ class DTMBA(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Diploma Teatri Musei Belle Arti"""
POLL_INTERVAL_DAYS = 30
ACTIVITY = "DTMBA"
ACTIVITY = ActivityName.DTMBA
DATA_URL = "https://www.iu1fig.com/share/iz0eik/dtmba/export.php"
def __init__(self, provider_config):
+2 -2
View File
@@ -3,7 +3,7 @@ from time import sleep
import pdfplumber
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import FileDownloadActivityRefDataProvider
@@ -12,7 +12,7 @@ class FEA(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Diploma Faros de España"""
POLL_INTERVAL_DAYS = 30
ACTIVITY = "FEA"
ACTIVITY = ActivityName.FEA
DATA_URL = "http://ea5ol.net/Lista%20Faros.pdf"
def __init__(self, provider_config):
@@ -22,7 +22,7 @@ class FileDownloadActivityRefDataProvider(ActivityRefDataProvider):
self._url = url
self._poll_interval = poll_interval
self._thread = None
self._url_data_cache = URLDataCache(f"sigrefdata_{sig_name}") # cache dir name kept for continuity
self._url_data_cache = URLDataCache(f"activity_ref_data_{sig_name}")
def start(self):
# Fire off the polling thread. It will poll immediately on startup, then sleep for poll_interval between
+2 -2
View File
@@ -1,7 +1,7 @@
import csv
from time import sleep
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import (
FileDownloadActivityRefDataProvider,
@@ -12,7 +12,7 @@ class GMA(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Global Mountain Activity"""
POLL_INTERVAL_DAYS = 30
ACTIVITY = "GMA"
ACTIVITY = ActivityName.GMA
DATA_URL = "https://www.gma.rocks/download/summits.csv"
def __init__(self, provider_config):
+2 -2
View File
@@ -1,7 +1,7 @@
import csv
from time import sleep
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import (
FileDownloadActivityRefDataProvider,
@@ -12,7 +12,7 @@ class ILLW(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for International Lighthouse & Lightship Weekend"""
POLL_INTERVAL_DAYS = 30
ACTIVITY = "ILLW"
ACTIVITY = ActivityName.ILLW
DATA_URL = "https://www.gma.rocks/download/lighthouse.csv"
def __init__(self, provider_config):
+2 -2
View File
@@ -3,7 +3,7 @@ from time import sleep
from pyhamtools.locator import latlong_to_locator
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import (
FileDownloadActivityRefDataProvider,
@@ -16,7 +16,7 @@ class IOTA(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Islands on the Air"""
POLL_INTERVAL_DAYS = 365
ACTIVITY = "IOTA"
ACTIVITY = ActivityName.IOTA
DATA_URL = "https://www.iota-world.org/islands-on-the-air/downloads/download-file.html?path=groups.json"
def __init__(self, provider_config):
+2 -1
View File
@@ -1,3 +1,4 @@
from core.enums import ActivityName
from providers.activityrefdata.pnp_kml_activity_ref_data_provider import (
ParksNPeaksKMLActivityRefDataProvider,
)
@@ -7,7 +8,7 @@ class KRMNPA(ParksNPeaksKMLActivityRefDataProvider):
"""Activity ref data provider for the Keith Roget Memorrial National Parks Award (KRMNPA)."""
POLL_INTERVAL_DAYS = 365
ACTIVITY = "KRMNPA"
ACTIVITY = ActivityName.KRMNPA
DATA_URL = "https://parksnpeaks.org/getPOI.php?poiClass=KRMNPA&poiFormat=4"
def __init__(self, provider_config):
+2 -2
View File
@@ -2,7 +2,7 @@ from time import sleep
from pyhamtools.locator import locator_to_latlong
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import (
FileDownloadActivityRefDataProvider,
@@ -13,7 +13,7 @@ class LLOTA(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Lagos y Lagunas on the Air"""
POLL_INTERVAL_DAYS = 7
ACTIVITY = "LLOTA"
ACTIVITY = ActivityName.LLOTA
DATA_URL = "https://llota.app/api/public/references"
def __init__(self, provider_config):
+2 -2
View File
@@ -1,7 +1,7 @@
import csv
from time import sleep
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import (
FileDownloadActivityRefDataProvider,
@@ -12,7 +12,7 @@ class MOTA(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Mills on the Air"""
POLL_INTERVAL_DAYS = 30
ACTIVITY = "MOTA"
ACTIVITY = ActivityName.MOTA
DATA_URL = "https://www.gma.rocks/download/mills.csv"
def __init__(self, provider_config):
+2 -2
View File
@@ -2,7 +2,7 @@ from time import sleep
from bs4 import BeautifulSoup
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import FileDownloadActivityRefDataProvider
@@ -11,7 +11,7 @@ class PGA(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Polish Gmina Award"""
POLL_INTERVAL_DAYS = 30
ACTIVITY = "PGA"
ACTIVITY = ActivityName.PGA
DATA_URL = "http://www.spga.pl/lista_pga2.php"
def __init__(self, provider_config):
+2 -2
View File
@@ -1,7 +1,7 @@
import csv
from time import sleep
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import (
FileDownloadActivityRefDataProvider,
@@ -12,7 +12,7 @@ class POTA(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Parks on the Air"""
POLL_INTERVAL_DAYS = 7
ACTIVITY = "POTA"
ACTIVITY = ActivityName.POTA
DATA_URL = "https://pota.app/all_parks_ext.csv"
def __init__(self, provider_config):
+2 -1
View File
@@ -1,3 +1,4 @@
from core.enums import ActivityName
from providers.activityrefdata.pnp_kml_activity_ref_data_provider import (
ParksNPeaksKMLActivityRefDataProvider,
)
@@ -7,7 +8,7 @@ class SANPCPA(ParksNPeaksKMLActivityRefDataProvider):
"""Activity ref data provider for the South Australia National Parks and Conservation Parks Award (SANPCPA)."""
POLL_INTERVAL_DAYS = 365
ACTIVITY = "SANPCPA"
ACTIVITY = ActivityName.SANPCPA
DATA_URL = "https://parksnpeaks.org/getPOI.php?poiClass=SANPCPA&poiFormat=4"
def __init__(self, provider_config):
+2 -2
View File
@@ -1,7 +1,7 @@
import csv
from time import sleep
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import (
FileDownloadActivityRefDataProvider,
@@ -12,7 +12,7 @@ class SIOTA(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Silos on the Air"""
POLL_INTERVAL_DAYS = 30
ACTIVITY = "SIOTA"
ACTIVITY = ActivityName.SIOTA
DATA_URL = "https://www.silosontheair.com/data/silos.csv"
def __init__(self, provider_config):
+2 -2
View File
@@ -3,7 +3,7 @@ from time import sleep
from pyhamtools.locator import latlong_to_locator
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import (
FileDownloadActivityRefDataProvider,
@@ -14,7 +14,7 @@ class SOTA(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Summits on the Air"""
POLL_INTERVAL_DAYS = 30
ACTIVITY = "SOTA"
ACTIVITY = ActivityName.SOTA
DATA_URL = "https://storage.sota.org.uk/summitslist.csv"
def __init__(self, provider_config):
+2 -2
View File
@@ -1,6 +1,6 @@
import csv
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.local_file_activity_ref_data_provider import (
LocalFileActivityRefDataProvider,
@@ -10,7 +10,7 @@ from providers.activityrefdata.local_file_activity_ref_data_provider import (
class Toilets(LocalFileActivityRefDataProvider):
"""Activity ref data provider for Toilets on the Air"""
ACTIVITY = "Toilets"
ACTIVITY = ActivityName.TOILETS
PATH = "datafiles/toilets.csv"
def __init__(self, provider_config):
+2 -2
View File
@@ -1,7 +1,7 @@
import csv
from time import sleep
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import (
FileDownloadActivityRefDataProvider,
@@ -12,7 +12,7 @@ class Towers(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Towers on the Air"""
POLL_INTERVAL_DAYS = 30
ACTIVITY = "Towers"
ACTIVITY = ActivityName.TOWERS
DATA_URL = "https://wwtota.com/servis/generate_csv.php?ref=&filter=all"
def __init__(self, provider_config):
+2 -2
View File
@@ -4,7 +4,7 @@ from time import sleep
from pyhamtools.locator import latlong_to_locator
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import (
FileDownloadActivityRefDataProvider,
@@ -17,7 +17,7 @@ class WCA(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for World Castles Award"""
POLL_INTERVAL_DAYS = 30
ACTIVITY = "WCA"
ACTIVITY = ActivityName.WCA
DATA_URL = "https://polo.ham2k.com/data/activities/wca/all-castles.csv"
def __init__(self, provider_config):
+2 -2
View File
@@ -1,6 +1,6 @@
from time import sleep
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import (
FileDownloadActivityRefDataProvider,
@@ -11,7 +11,7 @@ class WOTA(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Wainwrights on the Air"""
POLL_INTERVAL_DAYS = 365
ACTIVITY = "WOTA"
ACTIVITY = ActivityName.WOTA
DATA_URL = "https://www.wota.org.uk/mapping/data/summits.json"
def __init__(self, provider_config):
+2 -2
View File
@@ -1,7 +1,7 @@
import csv
from time import sleep
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import (
FileDownloadActivityRefDataProvider,
@@ -12,7 +12,7 @@ class WWBOTA(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Worldwide Bunkers on the Air"""
POLL_INTERVAL_DAYS = 30
ACTIVITY = "WWBOTA"
ACTIVITY = ActivityName.WWBOTA
DATA_URL = "https://api.wwbota.org/bunkers/?format=CSV"
def __init__(self, provider_config):
+2 -2
View File
@@ -1,7 +1,7 @@
import csv
from time import sleep
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import (
FileDownloadActivityRefDataProvider,
@@ -12,7 +12,7 @@ class WWFF(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for Worldwide Flora & Fauna"""
POLL_INTERVAL_DAYS = 30
ACTIVITY = "WWFF"
ACTIVITY = ActivityName.WWFF
DATA_URL = "https://wwff.co/wwff-data/wwff_directory.csv"
def __init__(self, provider_config):
+2 -2
View File
@@ -2,7 +2,7 @@ from time import sleep
from pyhamtools.locator import latlong_to_locator
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from providers.activityrefdata.file_download_activity_ref_data_provider import (
FileDownloadActivityRefDataProvider,
@@ -13,7 +13,7 @@ class ZLOTA(FileDownloadActivityRefDataProvider):
"""Activity ref data provider for New Zealand on the Air"""
POLL_INTERVAL_DAYS = 30
ACTIVITY = "ZLOTA"
ACTIVITY = ActivityName.ZLOTA
DATA_URL = "https://ontheair.nz/assets/assets.json"
def __init__(self, provider_config):
+3 -2
View File
@@ -3,6 +3,7 @@ from datetime import datetime, timedelta
import pytz
from bs4 import BeautifulSoup
from core.enums import ActivityName
from data.activity_ref import ActivityRef
from data.alert import Alert
from providers.alert.http_alert_provider import HTTPAlertProvider
@@ -55,8 +56,8 @@ class BOTA(HTTPAlertProvider):
alert = Alert(
source=self.name,
dx_calls=[dx_call],
sig="BOTA",
sig_refs=[ActivityRef(id=ref_name, sig="BOTA")],
sig=ActivityName.BOTA,
sig_refs=[ActivityRef(id=ref_name, sig=ActivityName.BOTA)],
start_time=date_time.timestamp(),
)
+3 -2
View File
@@ -2,6 +2,7 @@ from datetime import datetime
import pytz
from core.enums import ActivityName
from data.activity_ref import ActivityRef
from data.alert import Alert
from providers.alert.http_alert_provider import HTTPAlertProvider
@@ -34,11 +35,11 @@ class Hamsat(HTTPAlertProvider):
dx_calls=[source_alert["callsign"].upper()],
freqs_modes=freqs_modes,
comment=source_alert["comment"],
sig="Satellite",
sig=ActivityName.SATELLITE,
# Fudge an activity ref to provide the remaining bits of data we need: the satellite and the operator's grid
sig_refs=[
ActivityRef(
sig="Satellite",
sig=ActivityName.SATELLITE,
id=f"{source_alert['satellite']['name']} from {source_alert['grids'][0]}",
)
],
+2 -1
View File
@@ -6,6 +6,7 @@ import pytz
from rss_parser import Parser
from rss_parser.models.rss import RSS
from core.enums import ActivityName
from data.alert import Alert
from providers.alert.http_alert_provider import HTTPAlertProvider
@@ -88,7 +89,7 @@ class NG3K(HTTPAlertProvider):
comment=f"{by}; {comment}; {qsl_info}",
start_time=start_timestamp,
end_time=end_timestamp,
sig="DXpedition",
sig=ActivityName.DXPEDITION,
)
# Add to our list.
+13 -12
View File
@@ -3,6 +3,7 @@ from datetime import datetime
import pytz
from core.enums import ActivityName
from data.activity_ref import ActivityRef
from data.alert import Alert
from providers.alert.http_alert_provider import HTTPAlertProvider
@@ -39,7 +40,7 @@ class ParksNPeaks(HTTPAlertProvider):
activity_refs = []
# PnP can give us an alert of class "QRP" which is the only one that's not a real activity in Spothole's
# list, so mask this out if we got it.
if activity != "QRP":
if activity != ActivityName.QRP:
activity_refs = [ActivityRef(id=ref_id, sig=activity, name=ref_name)]
# Convert to our alert format
@@ -56,22 +57,22 @@ class ParksNPeaks(HTTPAlertProvider):
# Log a warning for the developer if PnP gives us an unknown programme we've never seen before
if activity and activity not in [
"POTA",
"SOTA",
"WWFF",
"HEMA",
"SIOTA",
"ZLOTA",
"KRMNPA",
"SANPCPA",
"LLOTA",
"QRP",
ActivityName.POTA,
ActivityName.SOTA,
ActivityName.WWFF,
ActivityName.HEMA,
ActivityName.SIOTA,
ActivityName.ZLOTA,
ActivityName.KRMNPA,
ActivityName.SANPCPA,
ActivityName.LLOTA,
ActivityName.QRP,
]:
logger.warning(f"PNP alert found with activity {activity}, developer needs to add support for this!")
# If this is POTA, SOTA or WWFF data we already have it through other means, so ignore. Otherwise, add to
# the alert list. Note that while ZLOTA has its own spots API, it doesn't have its own alerts API. So that
# means the PnP *spot* provider rejects ZLOTA spots here, but the PnP *alerts* provider here allows ZLOTA.
if activity not in ["POTA", "SOTA", "WWFF"]:
if activity not in [ActivityName.POTA, ActivityName.SOTA, ActivityName.WWFF]:
new_alerts.append(alert)
return new_alerts
+3 -2
View File
@@ -2,6 +2,7 @@ from datetime import datetime
import pytz
from core.enums import ActivityName
from data.activity_ref import ActivityRef
from data.alert import Alert
from providers.alert.http_alert_provider import HTTPAlertProvider
@@ -27,11 +28,11 @@ class POTA(HTTPAlertProvider):
dx_calls=[source_alert["activator"].upper()],
freqs_modes=source_alert["frequencies"],
comment=source_alert["comments"],
sig="POTA",
sig=ActivityName.POTA,
sig_refs=[
ActivityRef(
id=source_alert["reference"],
sig="POTA",
sig=ActivityName.POTA,
name=source_alert["name"],
url=f"https://pota.app/#/park/{source_alert['reference']}",
)
+2 -1
View File
@@ -3,6 +3,7 @@ import re
from icalendar import Event
from core.enums import Continent
from core.enums import ActivityName
from data.alert import Alert
from providers.alert.ical_alert_provider import ICALAlertProvider
@@ -69,7 +70,7 @@ class RSGBICALAlertProvider(ICALAlertProvider):
comment=summary,
start_time=start_timestamp,
end_time=end_timestamp,
sig="Contest",
sig=ActivityName.CONTEST,
)
return alert
+3 -2
View File
@@ -2,6 +2,7 @@ from datetime import datetime
import pytz
from core.enums import ActivityName
from data.activity_ref import ActivityRef
from data.alert import Alert
from providers.alert.http_alert_provider import HTTPAlertProvider
@@ -33,11 +34,11 @@ class SOTA(HTTPAlertProvider):
dx_names=[source_alert["activatorName"].upper()],
freqs_modes=source_alert["frequency"],
comment=source_alert["comments"],
sig="SOTA",
sig=ActivityName.SOTA,
sig_refs=[
ActivityRef(
id=f"{source_alert['associationCode']}/{source_alert['summitCode']}",
sig="SOTA",
sig=ActivityName.SOTA,
name=summit_name,
activation_score=summit_points,
)
+2 -1
View File
@@ -1,5 +1,6 @@
from icalendar import Event
from core.enums import ActivityName
from data.alert import Alert
from providers.alert.ical_alert_provider import ICALAlertProvider
@@ -34,7 +35,7 @@ class WA7BNM(ICALAlertProvider):
url=url,
start_time=start_timestamp,
end_time=end_timestamp,
sig="Contest",
sig=ActivityName.CONTEST,
)
return alert
+2 -1
View File
@@ -7,6 +7,7 @@ import pytz
from rss_parser import Parser as RSSParser
from rss_parser.models.rss import RSS
from core.enums import ActivityName
from data.activity_ref import ActivityRef
from data.alert import Alert
from providers.alert.http_alert_provider import HTTPAlertProvider
@@ -74,7 +75,7 @@ class WOTA(HTTPAlertProvider):
dx_calls=[dx_call],
freqs_modes=freqs_modes,
comment=comment,
sig_refs=[ActivityRef(id=ref, sig="WOTA", name=ref_name)] if ref else [],
sig_refs=[ActivityRef(id=ref, sig=ActivityName.WOTA, name=ref_name)] if ref else [],
start_time=time.timestamp(),
)
+3 -2
View File
@@ -2,6 +2,7 @@ from datetime import datetime
import pytz
from core.enums import ActivityName
from data.activity_ref import ActivityRef
from data.alert import Alert
from providers.alert.http_alert_provider import HTTPAlertProvider
@@ -27,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="WWFF",
sig_refs=[ActivityRef(id=source_alert["reference"], sig="WWFF")],
sig=ActivityName.WWFF,
sig_refs=[ActivityRef(id=source_alert["reference"], sig=ActivityName.WWFF)],
start_time=datetime.strptime(source_alert["utc_start"], "%Y-%m-%d %H:%M:%S")
.replace(tzinfo=pytz.UTC)
.timestamp(),
+18 -17
View File
@@ -4,7 +4,8 @@ from datetime import datetime
import pytz
from core.constants import HTTP_HEADERS
from core.enums import ActivityRefType, Mode
from core.enums import Mode
from core.enums import ActivityName, ActivityRefType
from core.url_data_cache import URLDataCache
from data.activity_ref import ActivityRef
from data.spot import Spot
@@ -106,40 +107,40 @@ class GMA(HTTPSpotProvider):
spot.sig_refs
and ref_info
and "reftype" in ref_info
and ref_info["reftype"] not in ["POTA", "WWFF"]
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"] == ""
)
):
match ref_info["reftype"]:
case "Summit":
spot.sig_refs[0].sig = "GMA"
spot.sig_refs[0].sig = ActivityName.GMA
spot.sig_refs[0].ref_type = ActivityRefType.SUMMIT
spot.sig = "GMA"
spot.sig = ActivityName.GMA
case "IOTA Island":
spot.sig_refs[0].sig = "IOTA"
spot.sig_refs[0].sig = ActivityName.IOTA
spot.sig_refs[0].ref_type = ActivityRefType.ISLAND
spot.sig = "IOTA"
spot.sig = ActivityName.IOTA
case "GMA Island":
spot.sig_refs[0].sig = "GMA Islands"
spot.sig_refs[0].sig = ActivityName.GMA_ISLANDS
spot.sig_refs[0].ref_type = ActivityRefType.ISLAND
spot.sig = "GMA Islands"
spot.sig = ActivityName.GMA_ISLANDS
case "Lighthouse (ILLW)":
spot.sig_refs[0].sig = "ILLW"
spot.sig_refs[0].sig = ActivityName.ILLW
spot.sig_refs[0].ref_type = ActivityRefType.LIGHTHOUSE
spot.sig = "ILLW"
spot.sig = ActivityName.ILLW
case "Lighthouse (ARLHS)":
spot.sig_refs[0].sig = "ARLHS"
spot.sig_refs[0].sig = ActivityName.ARLHS
spot.sig_refs[0].ref_type = ActivityRefType.LIGHTHOUSE
spot.sig = "ARLHS"
spot.sig = ActivityName.ARLHS
case "Castle":
spot.sig_refs[0].sig = "WCA"
spot.sig_refs[0].sig = ActivityName.WCA
spot.sig_refs[0].ref_type = ActivityRefType.CASTLE
spot.sig = "WCA"
spot.sig = ActivityName.WCA
case "Mill":
spot.sig_refs[0].sig = "MOTA"
spot.sig_refs[0].sig = ActivityName.MOTA
spot.sig_refs[0].ref_type = ActivityRefType.MILL
spot.sig = "MOTA"
spot.sig = ActivityName.MOTA
case _:
logger.warning(
f"GMA spot found with ref type {ref_info['reftype']}, developer needs to add support for this!"
@@ -170,7 +171,7 @@ class GMA(HTTPSpotProvider):
return new_spots
def can_submit_spot(self, activity):
return activity == "GMA"
return activity == ActivityName.GMA
def submit_spot(self, spot, credentials):
# TODO: Implement.
+5 -4
View File
@@ -7,7 +7,8 @@ import requests
from requests.exceptions import ConnectionError, ConnectTimeout, ReadTimeout
from core.constants import HTTP_HEADERS
from core.enums import ActivityRefType, Mode
from core.enums import Mode
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from data.spot import Spot
from providers.spot.http_spot_provider import HTTPSpotProvider
@@ -62,11 +63,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="HEMA",
sig=ActivityName.HEMA,
sig_refs=[
ActivityRef(
id=spot_items[3].upper(),
sig="HEMA",
sig=ActivityName.HEMA,
name=spot_items[4],
latitude=float(spot_items[7]),
longitude=float(spot_items[8]),
@@ -90,7 +91,7 @@ class HEMA(HTTPSpotProvider):
return new_spots
def can_submit_spot(self, activity):
return activity == "HEMA"
return activity == ActivityName.HEMA
def submit_spot(self, spot, credentials):
# TODO: Implement. Currently blocked awaiting their API team to make a change to allow us to spot with a
+4 -3
View File
@@ -1,6 +1,7 @@
from datetime import datetime
from core.enums import ActivityRefType, Mode
from core.enums import Mode
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from data.spot import Spot
from providers.spot.http_spot_provider import HTTPSpotProvider
@@ -34,11 +35,11 @@ class LLOTA(HTTPSpotProvider):
freq=float(source_spot["frequency"]) * 1000000,
mode=Mode.from_name(source_spot["mode"].upper()),
comment=comment,
sig="LLOTA",
sig=ActivityName.LLOTA,
sig_refs=[
ActivityRef(
id=source_spot["reference"],
sig="LLOTA",
sig=ActivityName.LLOTA,
name=source_spot["reference_name"],
ref_type=ActivityRefType.LAKE,
)
+20 -19
View File
@@ -7,6 +7,7 @@ import requests
from core.constants import HTTP_HEADERS
from core.enums import Mode
from core.enums import ActivityName
from data.activity_ref import ActivityRef
from data.spot import Spot
from providers.spot.http_spot_provider import HTTPSpotProvider
@@ -21,15 +22,15 @@ class ParksNPeaks(HTTPSpotProvider):
SPOTS_URL = "https://www.parksnpeaks.org/api/ALL"
SUBMIT_URL = "https://www.parksnpeaks.org/api/SPOT/"
SUBMITTABLE_ACTIVITIES = [
"POTA",
"SOTA",
"WWFF",
"HEMA",
"WOTA",
"ZLOTA",
"SIOTA",
"KRMNPA",
"SANPCPA",
ActivityName.POTA,
ActivityName.SOTA,
ActivityName.WWFF,
ActivityName.HEMA,
ActivityName.WOTA,
ActivityName.ZLOTA,
ActivityName.SIOTA,
ActivityName.KRMNPA,
ActivityName.SANPCPA,
]
def __init__(self, provider_config):
@@ -68,7 +69,7 @@ class ParksNPeaks(HTTPSpotProvider):
# programme with a defined set of references
activity = source_spot["actClass"].upper()
ref_id = source_spot["actSiteID"]
if activity and activity != "" and activity != "QRP" and ref_id and ref_id != "":
if activity and activity != "" and activity != ActivityName.QRP and ref_id and ref_id != "":
spot.sig = activity
activity_refs = [
ActivityRef(
@@ -84,15 +85,15 @@ class ParksNPeaks(HTTPSpotProvider):
# Log a warning for the developer if PnP gives us an unknown programme we've never seen before
if activity not in [
"POTA",
"SOTA",
"WWFF",
"HEMA",
"SIOTA",
"ZLOTA",
"KRMNPA",
"SANPCPA",
"LLOTA",
ActivityName.POTA,
ActivityName.SOTA,
ActivityName.WWFF,
ActivityName.HEMA,
ActivityName.SIOTA,
ActivityName.ZLOTA,
ActivityName.KRMNPA,
ActivityName.SANPCPA,
ActivityName.LLOTA,
]:
logger.warning(f"PNP spot found with activity {activity}, developer needs to add support for this!")
+5 -4
View File
@@ -4,7 +4,8 @@ import pytz
import requests
from core.constants import HTTP_HEADERS
from core.enums import ActivityRefType, Mode
from core.enums import Mode
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from data.spot import Spot
from providers.spot.http_spot_provider import HTTPSpotProvider
@@ -33,11 +34,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="POTA",
sig=ActivityName.POTA,
sig_refs=[
ActivityRef(
id=source_spot["reference"],
sig="POTA",
sig=ActivityName.POTA,
name=source_spot["name"],
latitude=source_spot["latitude"],
longitude=source_spot["longitude"],
@@ -58,7 +59,7 @@ class POTA(HTTPSpotProvider):
return new_spots
def can_submit_spot(self, activity):
return activity == "POTA"
return activity == ActivityName.POTA
def submit_spot(self, spot, credentials):
sig_ref = spot.sig_refs[0].id if spot.sig_refs else None
+5 -4
View File
@@ -5,7 +5,8 @@ import requests
from requests.exceptions import ConnectionError, ConnectTimeout, ReadTimeout
from core.constants import HTTP_HEADERS
from core.enums import ActivityRefType, Mode
from core.enums import Mode
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from data.spot import Spot
from providers.spot.http_spot_provider import HTTPSpotProvider
@@ -56,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="SOTA",
sig=ActivityName.SOTA,
sig_refs=[
ActivityRef(
id=source_spot["summitCode"],
sig="SOTA",
sig=ActivityName.SOTA,
name=source_spot["summitName"],
latitude=source_spot["latitude"],
longitude=source_spot["longitude"],
@@ -83,7 +84,7 @@ class SOTA(HTTPSpotProvider):
return new_spots
def can_submit_spot(self, activity):
return activity == "SOTA"
return activity == ActivityName.SOTA
def submit_spot(self, spot, credentials):
# TODO test this method works
+5 -4
View File
@@ -4,7 +4,8 @@ from datetime import datetime
import requests
from core.constants import HTTP_HEADERS
from core.enums import ActivityRefType, LocationSourceForSpot, Mode
from core.enums import LocationSourceForSpot, Mode
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from data.spot import Spot
from providers.spot.http_spot_provider import HTTPSpotProvider
@@ -58,13 +59,13 @@ class Tiles(HTTPSpotProvider):
freq=freq,
mode=Mode.from_name(source_spot["mode"].upper()),
comment=source_spot["notes"],
sig="Tiles",
sig=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=[
ActivityRef(
id=source_spot["maidenhead_grid"],
sig="Tiles",
sig=ActivityName.TILES,
name=source_spot["maidenhead_grid"],
latitude=source_spot["latitude"],
longitude=source_spot["longitude"],
@@ -84,7 +85,7 @@ class Tiles(HTTPSpotProvider):
return new_spots
def can_submit_spot(self, activity):
return activity == "Tiles"
return activity == ActivityName.TILES
def submit_spot(self, spot, credentials):
# Tiles on the air currently only supports *self* spots
+3 -3
View File
@@ -3,7 +3,7 @@ from datetime import datetime
import pytz
from core.enums import ActivityRefType
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from data.spot import Spot
from providers.spot.http_spot_provider import HTTPSpotProvider
@@ -34,8 +34,8 @@ class Towers(HTTPSpotProvider):
dx_call=source_spot["call"].upper(),
freq=likely_freq,
comment=source_spot["comment"],
sig="Towers",
sig_refs=[ActivityRef(id=source_spot["ref"], sig="Towers", ref_type=ActivityRefType.TOWER)],
sig=ActivityName.TOWERS,
sig_refs=[ActivityRef(id=source_spot["ref"], sig=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(),
+9 -4
View File
@@ -8,7 +8,8 @@ import pytz
from rss_parser import Parser
from rss_parser.models.rss import RSS
from core.enums import ActivityRefType, Mode
from core.enums import Mode
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from data.spot import Spot
from providers.spot.http_spot_provider import HTTPSpotProvider
@@ -90,8 +91,12 @@ class WOTA(HTTPSpotProvider):
freq=freq_hz,
mode=Mode.from_name(mode),
comment=comment,
sig="WOTA",
sig_refs=[ActivityRef(id=ref, sig="WOTA", name=ref_name, ref_type=ActivityRefType.SUMMIT)] if ref else [],
sig=ActivityName.WOTA,
sig_refs=(
[ActivityRef(id=ref, sig=ActivityName.WOTA, name=ref_name, ref_type=ActivityRefType.SUMMIT)]
if ref
else []
),
time=time.timestamp(),
)
@@ -105,7 +110,7 @@ class WOTA(HTTPSpotProvider):
return new_spots
def can_submit_spot(self, activity):
return activity == "WOTA"
return activity == ActivityName.WOTA
def submit_spot(self, spot, credentials):
# TODO Ask M5TEA if he's happy to share how this is done from his app
+5 -4
View File
@@ -1,7 +1,8 @@
import json
from datetime import datetime
from core.enums import ActivityRefType, Mode
from core.enums import Mode
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from data.spot import Spot
from providers.spot.sse_spot_provider import SSESpotProvider
@@ -23,7 +24,7 @@ class WWBOTA(SSESpotProvider):
for ref in source_spot["references"]:
activity_ref = ActivityRef(
id=ref["reference"],
sig="WWBOTA",
sig=ActivityName.WWBOTA,
name=ref["name"],
latitude=ref["lat"],
longitude=ref["long"],
@@ -38,7 +39,7 @@ class WWBOTA(SSESpotProvider):
freq=float(source_spot["freq"]) * 1000000,
mode=Mode.from_name(source_spot["mode"].upper()) if "mode" in source_spot else None,
comment=source_spot["comment"],
sig="WWBOTA",
sig=ActivityName.WWBOTA,
sig_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
@@ -53,7 +54,7 @@ class WWBOTA(SSESpotProvider):
return spot if source_spot["type"] != "Test" else None
def can_submit_spot(self, activity):
return activity == "WWBOTA"
return activity == ActivityName.WWBOTA
def submit_spot(self, spot, credentials):
# TODO: Implement. WWBOTA API docs cover this: https://api.wwbota.org/#tag/Spots/operation/create_spot_spots__post
+5 -4
View File
@@ -2,7 +2,8 @@ from datetime import datetime
import pytz
from core.enums import ActivityRefType, Mode
from core.enums import Mode
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from data.spot import Spot
from providers.spot.http_spot_provider import HTTPSpotProvider
@@ -30,11 +31,11 @@ class WWFF(HTTPSpotProvider):
freq=float(source_spot["frequency_khz"]) * 1000,
mode=Mode.from_name(source_spot["mode"].upper()),
comment=source_spot["remarks"],
sig="WWFF",
sig=ActivityName.WWFF,
sig_refs=[
ActivityRef(
id=source_spot["reference"],
sig="WWFF",
sig=ActivityName.WWFF,
name=source_spot["reference_name"],
latitude=source_spot["latitude"],
longitude=source_spot["longitude"],
@@ -52,7 +53,7 @@ class WWFF(HTTPSpotProvider):
return new_spots
def can_submit_spot(self, activity):
return activity == "WWFF"
return activity == ActivityName.WWFF
def submit_spot(self, spot, credentials):
# TODO: Implement. Spotting to WWFF should be possible, need to look up the Spotline docs or copy approach from
+4 -3
View File
@@ -3,6 +3,7 @@ from datetime import datetime
import pytz
from core.enums import Mode
from core.enums import ActivityName
from data.activity_ref import ActivityRef
from data.spot import Spot
from providers.spot.http_spot_provider import HTTPSpotProvider
@@ -35,11 +36,11 @@ class ZLOTA(HTTPSpotProvider):
freq=freq_hz,
mode=Mode.from_name(source_spot["mode"].upper().strip()),
comment=source_spot["comments"],
sig="ZLOTA",
sig=ActivityName.ZLOTA,
sig_refs=[
ActivityRef(
id=source_spot["reference"],
sig="ZLOTA",
sig=ActivityName.ZLOTA,
name=source_spot["name"],
)
],
@@ -52,7 +53,7 @@ class ZLOTA(HTTPSpotProvider):
return new_spots
def can_submit_spot(self, activity):
return activity == "ZLOTA"
return activity == ActivityName.ZLOTA
def submit_spot(self, spot, credentials):
# TODO: Implement. Spotting to ZLOTA is supported via POST, see https://ontheair.nz/api