server_microphone.py aktualisiert
This commit is contained in:
@@ -37,6 +37,8 @@ async def run_test():
|
|||||||
async with websockets.connect(args.uri) as websocket:
|
async with websockets.connect(args.uri) as websocket:
|
||||||
await websocket.send('{ "config" : { "sample_rate" : %d } }' % (device.samplerate))
|
await websocket.send('{ "config" : { "sample_rate" : %d } }' % (device.samplerate))
|
||||||
|
|
||||||
|
run_stop_only_once_flag = True
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
data = await audio_queue.get()
|
data = await audio_queue.get()
|
||||||
await websocket.send(data)
|
await websocket.send(data)
|
||||||
@@ -65,12 +67,15 @@ async def run_test():
|
|||||||
pixels.off()
|
pixels.off()
|
||||||
#os.system('~/tagesschau/start_news.sh')
|
#os.system('~/tagesschau/start_news.sh')
|
||||||
subprocess.Popen(["sh", "/home/pi/tagesschau/start_news.sh"])
|
subprocess.Popen(["sh", "/home/pi/tagesschau/start_news.sh"])
|
||||||
if "ruhe" in finalResult and "hex" in finalResult:
|
if "ruhe" in finalResult and "hex" in finalResult and run_stop_only_once_flag:
|
||||||
pixels.wakeup()
|
pixels.wakeup()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
pixels.off()
|
pixels.off()
|
||||||
#os.system('~/tagesschau/end_news.sh')
|
#os.system('~/tagesschau/end_news.sh')
|
||||||
subprocess.Popen(["sh", "/home/pi/tagesschau/end_news.sh"])
|
subprocess.Popen(["sh", "/home/pi/tagesschau/end_news.sh"])
|
||||||
|
run_stop_only_once_flag = False
|
||||||
|
if "ruhe" in finalResult and "hex" in finalResult and "result" in finalResult:
|
||||||
|
run_stop_only_once_flag = True
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user