This commit is contained in:
Jakob Ketterl 2020-04-05 21:48:05 +02:00
parent 8fdf263e4b
commit d07cbb2b10
1 changed files with 6 additions and 2 deletions

View File

@ -11,7 +11,7 @@ from owrx.config import Config
from owrx.metrics import Metrics, CounterMetric, DirectMetric
from owrx.pskreporter import PskReporter
from owrx.parser import Parser
from abc import ABCMeta, abstractmethod
from abc import ABC, ABCMeta, abstractmethod
import logging
@ -333,13 +333,17 @@ class WsjtParser(Parser):
metric.inc()
class Decoder(object):
class Decoder(ABC):
def parse_timestamp(self, instring, dateformat):
ts = datetime.strptime(instring, dateformat)
return int(
datetime.combine(datetime.utcnow().date(), ts.time()).replace(tzinfo=timezone.utc).timestamp() * 1000
)
@abstractmethod
def parse(self, msg, dial_freq):
pass
class Jt9Decoder(Decoder):
locator_pattern = re.compile("[A-Z0-9]+\\s([A-Z0-9]+)\\s([A-R]{2}[0-9]{2})$")