mirror of
https://github.com/jketterl/openwebrx.git
synced 2026-04-04 14:08:38 +00:00
add some basic infrastructure for hfdl
This commit is contained in:
parent
7eb277ce97
commit
f794f285f3
12 changed files with 118 additions and 31 deletions
|
|
@ -8,6 +8,9 @@ from subprocess import Popen, PIPE
|
|||
from functools import partial
|
||||
import pickle
|
||||
import logging
|
||||
import json
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Module(BaseModule, metaclass=ABCMeta):
|
||||
|
|
@ -146,6 +149,21 @@ class LineBasedModule(ThreadModule, metaclass=ABCMeta):
|
|||
pass
|
||||
|
||||
|
||||
class JsonParser(LineBasedModule):
|
||||
def __init__(self, mode: str):
|
||||
self.mode = mode
|
||||
super().__init__()
|
||||
|
||||
def process(self, line):
|
||||
try:
|
||||
msg = json.loads(line.decode())
|
||||
msg["mode"] = self.mode
|
||||
logger.debug(msg)
|
||||
return msg
|
||||
except json.JSONDecodeError:
|
||||
logger.exception("error parsing rtl433 json")
|
||||
|
||||
|
||||
class PopenModule(AutoStartModule, metaclass=ABCMeta):
|
||||
def __init__(self):
|
||||
self.process = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue