summaryrefslogtreecommitdiff
path: root/modules/input_handlers/pipewire_record.py
diff options
context:
space:
mode:
authorBotond Hende <nettingman@gmail.com>2024-11-20 13:46:44 +0100
committerBotond Hende <nettingman@gmail.com>2024-11-20 13:46:44 +0100
commita54f9cbed78ce3df4252c209553f4f318bc2b81e (patch)
tree138fcc62d161fe07d47d35ecd99043f2ffc340bd /modules/input_handlers/pipewire_record.py
parenta7448c94421b6ac874d33a5e0b4f8731931dad3e (diff)
cleanup pipo when exiting
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")