diff options
Diffstat (limited to '__main__.py')
-rw-r--r-- | __main__.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/__main__.py b/__main__.py index b51e70b..797ec56 100644 --- a/__main__.py +++ b/__main__.py @@ -1,15 +1,16 @@ import os -import sys import yaml from pathlib import Path +from modules.config import Config from .modules.config import load_config from .modules.hassil.recognize import recognize from .modules.hassil.util import merge_dict from .modules.hassil.intents import Intents, TextSlotList -from .modules.input_handlers.stdin_input import get_input_stdin -from .modules.input_handlers.pipewire_record import get_input_pw_record, cleanup + +from .modules.input_handlers.stdin_input import StdinInput +from .modules.input_handlers.pipewire_record import PipeWireRecord from .modules.intents import * @@ -40,9 +41,11 @@ def main(): intents = Intents.from_dict(input_dict) + input_handler = PipeWireRecord() if config.input_handler == Config.INPUT_PW else StdinInput() + try: # TODO select input type from config - for input_text in get_input_pw_record(): + for input_text in input_handler.get_input(): result = recognize(input_text, intents, slot_lists=slot_lists) if result is not None: result_dict = { @@ -55,7 +58,7 @@ def main(): else: print("<no match>") finally: - cleanup() + input_handler.cleanup() if __name__ == '__main__': main()
\ No newline at end of file |