Keep track of changed state

merge-requests/30/head
Bob Mottram 2021-03-02 13:16:27 +00:00
parent c2009a7c8a
commit 426daa6642
1 changed files with 18 additions and 17 deletions

View File

@ -1940,23 +1940,24 @@ if args.speaker:
httpPrefix, httpPrefix,
True, __version__) True, __version__)
if speakerJson: if speakerJson:
if speakerJson['say'] != prevSay and speakerJson.get('name'): if speakerJson['say'] != prevSay:
print(html.unescape(speakerJson['name']) + ': ' + if speakerJson.get('name'):
html.unescape(speakerJson['say']) + '\n') print(html.unescape(speakerJson['name']) + ': ' +
pitch = getSpeakerPitch(speakerJson['name']) html.unescape(speakerJson['say']) + '\n')
espeak.set_parameter(espeak.Parameter.Pitch, pitch) pitch = getSpeakerPitch(speakerJson['name'])
rate = getSpeakerRate(speakerJson['name']) espeak.set_parameter(espeak.Parameter.Pitch, pitch)
espeak.set_parameter(espeak.Parameter.Rate, rate) rate = getSpeakerRate(speakerJson['name'])
srange = getSpeakerRange(speakerJson['name']) espeak.set_parameter(espeak.Parameter.Rate, rate)
espeak.set_parameter(espeak.Parameter.Range, srange) srange = getSpeakerRange(speakerJson['name'])
espeak.synth(html.unescape(speakerJson['name'])) espeak.set_parameter(espeak.Parameter.Range, srange)
time.sleep(3) espeak.synth(html.unescape(speakerJson['name']))
if not speakerJson.get('imageDescription'): time.sleep(3)
sayStr = speakerJson['say'] if not speakerJson.get('imageDescription'):
else: sayStr = speakerJson['say']
sayStr = speakerJson['say'] + '. ' + \ else:
speakerJson['imageDescription'] sayStr = speakerJson['say'] + '. ' + \
espeak.synth(html.unescape(sayStr)) speakerJson['imageDescription']
espeak.synth(html.unescape(sayStr))
prevSay = speakerJson['say'] prevSay = speakerJson['say']
time.sleep(30) time.sleep(30)