diff --git a/rust-whisper.d/hotwords.py b/rust-whisper.d/hotwords.py index 51bc89e..13ee1ec 100644 --- a/rust-whisper.d/hotwords.py +++ b/rust-whisper.d/hotwords.py @@ -47,7 +47,7 @@ class Reader(threading.Thread): self.name = os.environ.get("MIC_NAME", "pulse_monitor") if not self.name: for index, name in enumerate(sr.Microphone.list_microphone_names()): - print("[{0}] Microphone with name \"{1}\" found for `Microphone(device_index={0})`".format(index, name)) + log("[{0}] Microphone with name \"{1}\" found for `Microphone(device_index={0})`".format(index, name)) exit() self.inq = inq self.outq = outq @@ -261,11 +261,15 @@ class Reactor(threading.Thread): def handle(self, text): hotwords = self.load_hotwords() if os.environ.get("DEBUG", None): - log(f"seeking {hotwords} in {text}") + log(f"seeking {hotwords} in {text}. $HOTWORDS={os.environ.get('HOTWORDS', None)}") if not hotwords: if not os.environ.get("HOTWORDS", None): - print(text) + if os.environ.get("DEBUG", None): + log(f"HOTWORDS is False; {text}") + print(text, flush=True) else: + if os.environ.get("DEBUG", None): + log(f"HOTWORDS is True; {text}") log(text) return cleantext = "".join([i for i in "".join(text.lower().split()) if i.isalpha()]) @@ -305,7 +309,7 @@ class Actor(threading.Thread): def handle_stdout(self, hotword, context): log(context) - print(hotword) + print(hotword, flush=True) def handle_signal(self, hotword, context): self.handle_stderr(hotword, context) diff --git a/rust-whisper.d/transcript.sh b/rust-whisper.d/transcript.sh index c40a7bb..24b6321 100644 --- a/rust-whisper.d/transcript.sh +++ b/rust-whisper.d/transcript.sh @@ -1 +1 @@ -echo "pkill -9 -f hotwords.py; MIC_TIMEOUT=30 MODEL=small.en P=4 DEBUG=true python3 ./hotwords.py | tee $HOME/Downloads/transcript-$(date +%Y-%m-%d).txt" +echo "pkill -9 -f hotwords.py; MIC_TIMEOUT=30 MODEL=small.en P=4 DEBUG=true HOTWORDS= python3 ./hotwords.py | tee -a $HOME/Downloads/transcript-$(date +%Y-%m-%d).txt"