master
bel 2023-04-12 19:26:03 -06:00
parent 5869016de6
commit 410769b8c6
2 changed files with 9 additions and 5 deletions

View File

@ -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)

View File

@ -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"