Capture comments like JO21sv -> IO70vt. Closes #121

This commit is contained in:
Ian Renton
2026-08-08 08:23:49 +01:00
parent 985646bb94
commit 3ab2375a32
9 changed files with 28 additions and 15 deletions
+13
View File
@@ -325,6 +325,19 @@ class Spot:
self.propagation_mode = mode_tag
logging.info("Seen a new propagation mode tag not yet in the system: %s", mode_tag)
# Parse "de_grid -> dx_grid" structures from the comment
if self.comment:
grid_mode_grid_match = re.search(
r'\b([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\s*->\s*([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\b',
self.comment)
if grid_mode_grid_match:
# regex matches, so extract grids:
if not self.dx_grid:
self.dx_grid = grid_mode_grid_match.group(1).upper()
self.dx_location_source = "SPOT"
if not self.de_grid:
self.de_grid = grid_mode_grid_match.group(2).upper()
# DX Grid to lat/lon and vice versa in case one is missing
if self.dx_grid and not self.dx_latitude:
try: