Include announced handle within speaker interface

merge-requests/30/head
Bob Mottram 2021-03-01 23:14:05 +00:00
parent 2787ceb724
commit 2b26b09980
1 changed files with 9 additions and 3 deletions

View File

@ -1412,7 +1412,7 @@ def _receiveAnnounce(recentPostsCache: {},
if not alreadyExists: if not alreadyExists:
_updateSpeaker(baseDir, nickname, domain, _updateSpeaker(baseDir, nickname, domain,
postJsonObject, personCache, postJsonObject, personCache,
translate) translate, lookupActor)
if debug: if debug:
print('DEBUG: Obtaining actor for announce post ' + print('DEBUG: Obtaining actor for announce post ' +
@ -2149,7 +2149,7 @@ def _bounceDM(senderPostId: str, session, httpPrefix: str,
def _updateSpeaker(baseDir: str, nickname: str, domain: str, def _updateSpeaker(baseDir: str, nickname: str, domain: str,
postJsonObject: {}, personCache: {}, postJsonObject: {}, personCache: {},
translate: {}) -> None: translate: {}, announcingActor: str) -> None:
""" Generates a json file which can be used for TTS announcement """ Generates a json file which can be used for TTS announcement
of incoming inbox posts of incoming inbox posts
""" """
@ -2192,6 +2192,12 @@ def _updateSpeaker(baseDir: str, nickname: str, domain: str,
getDisplayName(baseDir, postJsonObject['actor'], personCache) getDisplayName(baseDir, postJsonObject['actor'], personCache)
if not speakerName: if not speakerName:
return return
if announcingActor:
announcedNickname = getNicknameFromActor(announcingActor)
announcedDomain = getDomainFromActor(announcingActor)
announcedHandle = announcedNickname + '@' + announcedDomain
content = \
translate['announces'] + ' ' + announcedHandle + '. ' + content
speakerJson = { speakerJson = {
"name": speakerName, "name": speakerName,
"summary": summary, "summary": summary,
@ -2539,7 +2545,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
if boxname == 'inbox': if boxname == 'inbox':
_updateSpeaker(baseDir, nickname, domain, _updateSpeaker(baseDir, nickname, domain,
postJsonObject, personCache, postJsonObject, personCache,
translate) translate, None)
if not unitTest: if not unitTest:
if debug: if debug:
print('Saving inbox post as html to cache') print('Saving inbox post as html to cache')