Add QRZ lookup

This commit is contained in:
Ian Renton
2025-09-27 15:24:53 +01:00
parent 00c56a7c10
commit cf1798663d
4 changed files with 83 additions and 26 deletions

View File

@@ -8,7 +8,7 @@ from pyhamtools.locator import locator_to_latlong, latlong_to_locator
from core.constants import DXCC_FLAGS
from core.utils import infer_mode_family_from_mode, infer_band_from_freq, infer_continent_from_callsign, \
infer_country_from_callsign, infer_cq_zone_from_callsign, infer_itu_zone_from_callsign, infer_dxcc_id_from_callsign, \
infer_mode_from_comment
infer_mode_from_comment, infer_name_from_callsign, infer_latlon_from_callsign, infer_grid_from_callsign
# Data class that defines a spot.
@@ -130,9 +130,18 @@ class Spot:
if self.comment and not self.qrt:
self.qrt = "QRT" in self.comment.upper()
# TODO use QRZ/HamQTH provider to get grids, lat Lon, when missing; and DX name
# credentials in config file which is .gitignored; sample provided
# TODO lat/lon from DXCC centre as last resort?
# DX operator details lookup, using QRZ.com. This should be the last resort compared to taking the data from
# 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 = infer_name_from_callsign(self.dx_call)
if self.dx_call and not self.latitude:
latlon = infer_latlon_from_callsign(self.dx_call)
if latlon:
self.latitude = latlon[0]
self.longitude = latlon[1]
if self.dx_call and not self.grid:
self.grid = infer_grid_from_callsign(self.dx_call)
# JSON serialise
def to_json(self):