From a54f9cbed78ce3df4252c209553f4f318bc2b81e Mon Sep 17 00:00:00 2001 From: Botond Hende Date: Wed, 20 Nov 2024 13:46:44 +0100 Subject: cleanup pipo when exiting --- modules/input_handlers/pipewire_record.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'modules') diff --git a/modules/input_handlers/pipewire_record.py b/modules/input_handlers/pipewire_record.py index 8584ad3..147d77b 100644 --- a/modules/input_handlers/pipewire_record.py +++ b/modules/input_handlers/pipewire_record.py @@ -9,12 +9,15 @@ import whisper FIFO_PATH = "/tmp/hestia-listening" RECORD_PATH = "/tmp/hestia-record.mp3" -def get_input_pw_record(): - device = get_device() - +def cleanup(): if os.path.exists(FIFO_PATH): os.remove(FIFO_PATH) + +def get_input_pw_record(): + device = get_device() + + cleanup() os.mkfifo(FIFO_PATH) while True: @@ -33,7 +36,7 @@ def get_input_pw_record(): ps.kill() # TODO "error" # TODO exit gracefully or try to recover - sys.exit() + raise StopIteration model = whisper.load_model("base") -- cgit v1.2.3-70-g09d2