Extra speaker announce endpoint

main
Bob Mottram 2021-03-03 19:27:29 +00:00
parent 76314d55b6
commit 6b6304b595
1 changed files with 14 additions and 0 deletions

View File

@ -63,6 +63,7 @@ from webapp_media import addEmbeddedElements
from webapp_question import insertQuestion
from devices import E2EEdecryptMessageFromDevice
from webfinger import webfingerHandle
from speaker import updateSpeaker
def _logPostTiming(enableTimingLog: bool, postStartTime, debugId: str) -> None:
@ -1290,6 +1291,19 @@ def individualPostAsHtml(allowDownloads: bool,
if not postJsonAnnounce:
return ''
postJsonObject = postJsonAnnounce
announceFilename = \
locatePost(baseDir, nickname, domain, postJsonObject['id'])
if announceFilename and postJsonObject.get('actor'):
if not os.path.isfile(announceFilename + '.tts'):
updateSpeaker(baseDir, nickname, domain,
postJsonObject, personCache,
translate, postJsonObject['actor'])
ttsFile = open(announceFilename + '.tts', "w+")
if ttsFile:
ttsFile.write('\n')
ttsFile.close()
isAnnounced = True
_logPostTiming(enableTimingLog, postStartTime, '8')