create a base class for python-implemented modules

This commit is contained in:
Jakob Ketterl
2021-09-01 15:08:28 +02:00
parent 51453662e2
commit 01260d66c8
3 changed files with 22 additions and 8 deletions

View File

@ -4,7 +4,7 @@ import threading
from owrx.audio import ProfileSourceSubscriber
from owrx.audio.wav import AudioWriter
from owrx.audio.queue import QueueJob
from csdr.chain import Chain
from csdr.module import Module
import pickle
import logging
@ -13,7 +13,7 @@ logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
class AudioChopper(threading.Thread, Chain, ProfileSourceSubscriber):
class AudioChopper(threading.Thread, Module, ProfileSourceSubscriber):
# TODO parser typing
def __init__(self, mode_str: str, parser):
self.parser = parser
@ -25,7 +25,7 @@ class AudioChopper(threading.Thread, Chain, ProfileSourceSubscriber):
raise ValueError("Mode {} is not an audio chopper mode".format(mode_str))
self.profile_source = mode.get_profile_source()
super().__init__()
Chain.__init__(self, [])
Module.__init__(self)
def stop_writers(self):
while self.writers: