in TSA-demo/TSA_voice_assistant/raspberry_voice_assistant.py [0:0]
def main():
print("starting")
#word()
#print ('bot: ', bot)
print("going to record")
session_id = str(uuid.uuid4())
#while 1:
while iot_sub.launchlextt:
try:
if platform_sys != 'Darwin':
set_color(COLORS_RGB[KEYWORDS_COLOR['porcupine']])
print('iot_sub.launchlextt2: ', iot_sub.launchlextt)
recording = record_phrase()
if not iot_sub.launchlextt:
print('stop in middle')
break
response = call_lexv2(session_id, bytes(recording))
if response == 'none':
break
play_audio(response['audioStream'])
session_state = decode(response['sessionState'])
dialog_action = session_state['dialogAction']['type']
state = session_state['intent']['state']
if dialog_action == 'Close' and state == 'Fulfilled':
break
except Exception as e:
print(e)