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

18 wiersze
540 B
Python
Czysty Zwykły widok Historia

2018-03-10 08:15:09 +00:00
import re
from ogn.parser.utils import fpm2ms
2018-03-10 08:35:51 +00:00
from ogn.parser.pattern import PATTERN_SKYLINES_POSITION_COMMENT
2018-03-10 08:15:09 +00:00
2017-10-05 08:36:53 +00:00
from .base import BaseParser
class SkylinesParser(BaseParser):
def __init__(self):
self.beacon_type = 'skylines'
2018-03-10 08:15:09 +00:00
@staticmethod
def parse_position(aprs_comment):
2018-03-10 08:35:51 +00:00
ac_match = re.search(PATTERN_SKYLINES_POSITION_COMMENT, aprs_comment)
2018-04-28 19:31:50 +00:00
return {'address': ac_match.group('id'),
2018-03-10 08:15:09 +00:00
'climb_rate': int(ac_match.group('climb_rate')) * fpm2ms if ac_match.group('climb_rate') else None}