master
parent
5869016de6
commit
410769b8c6
|
|
@ -47,7 +47,7 @@ class Reader(threading.Thread):
|
||||||
self.name = os.environ.get("MIC_NAME", "pulse_monitor")
|
self.name = os.environ.get("MIC_NAME", "pulse_monitor")
|
||||||
if not self.name:
|
if not self.name:
|
||||||
for index, name in enumerate(sr.Microphone.list_microphone_names()):
|
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()
|
exit()
|
||||||
self.inq = inq
|
self.inq = inq
|
||||||
self.outq = outq
|
self.outq = outq
|
||||||
|
|
@ -261,11 +261,15 @@ class Reactor(threading.Thread):
|
||||||
def handle(self, text):
|
def handle(self, text):
|
||||||
hotwords = self.load_hotwords()
|
hotwords = self.load_hotwords()
|
||||||
if os.environ.get("DEBUG", None):
|
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 hotwords:
|
||||||
if not os.environ.get("HOTWORDS", None):
|
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:
|
else:
|
||||||
|
if os.environ.get("DEBUG", None):
|
||||||
|
log(f"HOTWORDS is True; {text}")
|
||||||
log(text)
|
log(text)
|
||||||
return
|
return
|
||||||
cleantext = "".join([i for i in "".join(text.lower().split()) if i.isalpha()])
|
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):
|
def handle_stdout(self, hotword, context):
|
||||||
log(context)
|
log(context)
|
||||||
print(hotword)
|
print(hotword, flush=True)
|
||||||
|
|
||||||
def handle_signal(self, hotword, context):
|
def handle_signal(self, hotword, context):
|
||||||
self.handle_stderr(hotword, context)
|
self.handle_stderr(hotword, context)
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue