diff --git a/server_microphone.py b/server_microphone.py index aa6ac97..ca28d15 100644 --- a/server_microphone.py +++ b/server_microphone.py @@ -37,6 +37,8 @@ async def run_test(): async with websockets.connect(args.uri) as websocket: await websocket.send('{ "config" : { "sample_rate" : %d } }' % (device.samplerate)) + run_stop_only_once_flag = True + while True: data = await audio_queue.get() await websocket.send(data) @@ -65,12 +67,15 @@ async def run_test(): pixels.off() #os.system('~/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() time.sleep(1) pixels.off() #os.system('~/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():