change in start line of script

new_voices
jocavdh 6 years ago
parent 1603262c1f
commit 81d8e9317b

@ -20,11 +20,13 @@ def on_connect(client, userdata, flags, rc):
client.subscribe('hermes/intent/jocavdh:ask')
client.subscribe('hermes/intent/jocavdh:answer_yes')
def on_introduce(client,data,msg):
def on_introduce(client,data,msg, line_number = 0):
data = json.loads(msg.payload)
sessionId = data['sessionId']
for character, line, direction in read_script('play_scripts/demo.txt'):
script_lines = read_script('play_scripts/demo.txt')
for character, line, direction in script_lines[line_number:]:
input_text = line
voice = characters.get(character)[0]
speaker = characters.get(character)[1]
@ -32,6 +34,7 @@ def on_introduce(client,data,msg):
# Some way to do something with the stage directions will come here
action = directions.get(direction[0])
tts(voice, input_text, speaker)
line_number +=1
print('say this sentence')
if action == 'listen_audience':
@ -64,6 +67,8 @@ def on_introduce(client,data,msg):
# 'siteId': 'default'
# }))
return line_number
break
@ -89,10 +94,10 @@ def on_answer(client,data,msg):
def onIntentNotRecognized(client, data, msg):
data = json.loads(msg.payload)
start_line = on_introduce()
print('not recognized')
on_introduce(client,data,msg)
on_introduce(client,data,msg, start_line)
client = mqtt.Client()

Loading…
Cancel
Save