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.synth(html.unescape(speakerJson['name']))
|
||||
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']
|
||||
time.sleep(20)
|
||||
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 = html.unescape(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 = ''
|
||||
if postJsonObject['object'].get('summary'):
|
||||
if isinstance(postJsonObject['object']['summary'], str):
|
||||
summary = \
|
||||
urllib.parse.unquote_plus(postJsonObject['object']['summary'])
|
||||
summary = html.unescape(summary)
|
||||
|
||||
speakerName = \
|
||||
getDisplayName(baseDir, postJsonObject['actor'], personCache)
|
||||
speakerJson = {
|
||||
"name": speakerName,
|
||||
"summary": summary,
|
||||
"say": content
|
||||
"say": content,
|
||||
"imageDescription": imageDescription
|
||||
}
|
||||
saveJson(speakerJson, speakerFilename)
|
||||
|
||||
|
|
Loading…
Reference in New Issue