master
bel 2023-03-25 21:47:56 -06:00
parent 6ce38738f5
commit 96585d4787
1 changed files with 5 additions and 5 deletions

View File

@ -147,7 +147,7 @@ class Reactor(threading.Thread):
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()])
for i in hotwords: for i in hotwords:
if i in cleantext: if i in cleantext:
log(f"Reactor.handle: found hotword '{i}' in '{text}' as '{cleantext}'") #log(f"Reactor.handle: found hotword '{i}' in '{text}' as '{cleantext}'")
self.outq.put((i, text)) self.outq.put((i, text))
class Actor(threading.Thread): class Actor(threading.Thread):
@ -158,14 +158,14 @@ class Actor(threading.Thread):
def run(self): def run(self):
log("Actor.run: start") log("Actor.run: start")
while True: while True:
hotword, context = self.inq.get() got = self.inq.get()
if hotword is None: if got is None:
break break
self.handle(hotword, context) self.handle(got[0], got[1])
log("Actor.run: stop") log("Actor.run: stop")
def handle(self, hotword, context): def handle(self, hotword, context):
print(f'{hotword} in {context}') print(f"'{hotword}' in '{context}'")
if __name__ == "__main__": if __name__ == "__main__":
main() main()