summaryrefslogtreecommitdiff
path: root/modules/input_handlers/pipewire_record.py
diff options
context:
space:
mode:
Diffstat (limited to 'modules/input_handlers/pipewire_record.py')
-rw-r--r--modules/input_handlers/pipewire_record.py11
1 files changed, 7 insertions, 4 deletions
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")