mirror of https://gitlab.com/bashrc2/epicyon
Speak image descriptions
parent
5e85887cd1
commit
7062c0a1c8
|
@ -1951,7 +1951,13 @@ if args.speaker:
|
||||||
espeak.set_parameter(espeak.Parameter.Range, srange)
|
espeak.set_parameter(espeak.Parameter.Range, srange)
|
||||||
espeak.synth(html.unescape(speakerJson['name']))
|
espeak.synth(html.unescape(speakerJson['name']))
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
espeak.synth(html.unescape(speakerJson['say']))
|
if not speakerJson['imageDescription']:
|
||||||
|
sayStr = speakerJson['say']
|
||||||
|
else:
|
||||||
|
sayStr = speakerJson['say'] + '. ' + \
|
||||||
|
speakerJson['imageDescription']
|
||||||
|
espeak.synth(html.unescape(sayStr))
|
||||||
|
|
||||||
prevSay = speakerJson['say']
|
prevSay = speakerJson['say']
|
||||||
time.sleep(20)
|
time.sleep(20)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
17
inbox.py
17
inbox.py
|
@ -2157,18 +2157,33 @@ def _updateSpeaker(baseDir: str, nickname: str, domain: str,
|
||||||
content = urllib.parse.unquote_plus(postJsonObject['object']['content'])
|
content = urllib.parse.unquote_plus(postJsonObject['object']['content'])
|
||||||
content = html.unescape(content)
|
content = html.unescape(content)
|
||||||
content = removeHtml(htmlReplaceQuoteMarks(content))
|
content = removeHtml(htmlReplaceQuoteMarks(content))
|
||||||
|
|
||||||
|
imageDescription = ''
|
||||||
|
if postJsonObject['object'].get('attachment'):
|
||||||
|
attachList = postJsonObject['object']['attachment']
|
||||||
|
if isinstance(attachList, list):
|
||||||
|
for img in attachList:
|
||||||
|
if not isinstance(img, dict):
|
||||||
|
continue
|
||||||
|
if img.get('name'):
|
||||||
|
if isinstance(img['name'], str):
|
||||||
|
imageDescription += \
|
||||||
|
img['name'] + '. '
|
||||||
|
|
||||||
summary = ''
|
summary = ''
|
||||||
if postJsonObject['object'].get('summary'):
|
if postJsonObject['object'].get('summary'):
|
||||||
if isinstance(postJsonObject['object']['summary'], str):
|
if isinstance(postJsonObject['object']['summary'], str):
|
||||||
summary = \
|
summary = \
|
||||||
urllib.parse.unquote_plus(postJsonObject['object']['summary'])
|
urllib.parse.unquote_plus(postJsonObject['object']['summary'])
|
||||||
summary = html.unescape(summary)
|
summary = html.unescape(summary)
|
||||||
|
|
||||||
speakerName = \
|
speakerName = \
|
||||||
getDisplayName(baseDir, postJsonObject['actor'], personCache)
|
getDisplayName(baseDir, postJsonObject['actor'], personCache)
|
||||||
speakerJson = {
|
speakerJson = {
|
||||||
"name": speakerName,
|
"name": speakerName,
|
||||||
"summary": summary,
|
"summary": summary,
|
||||||
"say": content
|
"say": content,
|
||||||
|
"imageDescription": imageDescription
|
||||||
}
|
}
|
||||||
saveJson(speakerJson, speakerFilename)
|
saveJson(speakerJson, speakerFilename)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue