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

18 wiersze
549 B
Python
Czysty Zwykły widok Historia

import re
2018-03-10 08:35:51 +00:00
from ogn.parser.pattern import PATTERN_SPOT_POSITION_COMMENT
2017-10-05 08:36:53 +00:00
from .base import BaseParser
class SpotParser(BaseParser):
def __init__(self):
self.beacon_type = 'spot'
@staticmethod
def parse_position(aprs_comment):
2018-03-10 08:35:51 +00:00
ac_match = re.search(PATTERN_SPOT_POSITION_COMMENT, aprs_comment)
2018-04-28 16:45:23 +00:00
return {'address': ac_match.group('id'),
2018-09-18 16:39:36 +00:00
'model': ac_match.group('model') if ac_match.group('model') else None,
'status': ac_match.group('status') if ac_match.group('status') else None}