mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Add QRZ lookup
This commit is contained in:
17
data/spot.py
17
data/spot.py
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user