hotwords is K
parent
c46fe808fd
commit
6ce38738f5
|
|
@ -148,7 +148,7 @@ class Reactor(threading.Thread):
|
||||||
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)
|
self.outq.put((i, text))
|
||||||
|
|
||||||
class Actor(threading.Thread):
|
class Actor(threading.Thread):
|
||||||
def __init__(self, inq):
|
def __init__(self, inq):
|
||||||
|
|
@ -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 = self.inq.get()
|
hotword, context = self.inq.get()
|
||||||
if hotword is None:
|
if hotword is None:
|
||||||
break
|
break
|
||||||
self.handle(hotword)
|
self.handle(hotword, context)
|
||||||
log("Actor.run: stop")
|
log("Actor.run: stop")
|
||||||
|
|
||||||
def handle(self, hotword):
|
def handle(self, hotword, context):
|
||||||
print(hotword)
|
print(f'{hotword} in {context}')
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue