python-ogn-client/ogn/parser/aprs_comment/spot_parser.py

18 wiersze
549 B
Python

import re
from ogn.parser.pattern import PATTERN_SPOT_POSITION_COMMENT
from .base import BaseParser
class SpotParser(BaseParser):
def __init__(self):
self.beacon_type = 'spot'
@staticmethod
def parse_position(aprs_comment):
ac_match = re.search(PATTERN_SPOT_POSITION_COMMENT, aprs_comment)
return {'address': ac_match.group('id'),
'model': ac_match.group('model') if ac_match.group('model') else None,
'status': ac_match.group('status') if ac_match.group('status') else None}