mirror of https://gitlab.com/bashrc2/epicyon
Preserve original notification content
parent
ff2fb5bcfe
commit
073b322d36
22
speaker.py
22
speaker.py
|
@ -274,7 +274,8 @@ def getSpeakerFromServer(baseDir: str, session,
|
||||||
|
|
||||||
|
|
||||||
def _speakerEndpointJson(displayName: str, summary: str,
|
def _speakerEndpointJson(displayName: str, summary: str,
|
||||||
content: str, imageDescription: str,
|
content: str, sayContent: str,
|
||||||
|
imageDescription: str,
|
||||||
links: [], gender: str, postId: str,
|
links: [], gender: str, postId: str,
|
||||||
postDM: bool, postReply: bool,
|
postDM: bool, postReply: bool,
|
||||||
followRequestsExist: bool,
|
followRequestsExist: bool,
|
||||||
|
@ -285,7 +286,8 @@ def _speakerEndpointJson(displayName: str, summary: str,
|
||||||
speakerJson = {
|
speakerJson = {
|
||||||
"name": displayName,
|
"name": displayName,
|
||||||
"summary": summary,
|
"summary": summary,
|
||||||
"say": content,
|
"content": content,
|
||||||
|
"say": sayContent,
|
||||||
"imageDescription": imageDescription,
|
"imageDescription": imageDescription,
|
||||||
"detectedLinks": links,
|
"detectedLinks": links,
|
||||||
"id": postId,
|
"id": postId,
|
||||||
|
@ -412,11 +414,12 @@ def _postToSpeakerJson(baseDir: str, httpPrefix: str,
|
||||||
content = content.replace(' <3', ' ' + translate['heart'])
|
content = content.replace(' <3', ' ' + translate['heart'])
|
||||||
content = removeHtml(htmlReplaceQuoteMarks(content))
|
content = removeHtml(htmlReplaceQuoteMarks(content))
|
||||||
content = speakerReplaceLinks(content, translate, detectedLinks)
|
content = speakerReplaceLinks(content, translate, detectedLinks)
|
||||||
content = _speakerPronounce(baseDir, content, translate)
|
sayContent = content
|
||||||
|
sayContent = _speakerPronounce(baseDir, content, translate)
|
||||||
# replace all double spaces
|
# replace all double spaces
|
||||||
while ' ' in content:
|
while ' ' in sayContent:
|
||||||
content = content.replace(' ', ' ')
|
sayContent = sayContent.replace(' ', ' ')
|
||||||
content = content.replace(' . ', '. ')
|
sayContent = sayContent.replace(' . ', '. ')
|
||||||
|
|
||||||
imageDescription = ''
|
imageDescription = ''
|
||||||
if postJsonObject['object'].get('attachment'):
|
if postJsonObject['object'].get('attachment'):
|
||||||
|
@ -451,8 +454,9 @@ def _postToSpeakerJson(baseDir: str, httpPrefix: str,
|
||||||
announcedDomain, announcedport = getDomainFromActor(announcingActor)
|
announcedDomain, announcedport = getDomainFromActor(announcingActor)
|
||||||
if announcedNickname and announcedDomain:
|
if announcedNickname and announcedDomain:
|
||||||
announcedHandle = announcedNickname + '@' + announcedDomain
|
announcedHandle = announcedNickname + '@' + announcedDomain
|
||||||
content = \
|
sayContent = \
|
||||||
translate['announces'] + ' ' + announcedHandle + '. ' + content
|
translate['announces'] + ' ' + \
|
||||||
|
announcedHandle + '. ' + sayContent
|
||||||
postId = None
|
postId = None
|
||||||
if postJsonObject['object'].get('id'):
|
if postJsonObject['object'].get('id'):
|
||||||
postId = postJsonObject['object']['id']
|
postId = postJsonObject['object']['id']
|
||||||
|
@ -484,7 +488,7 @@ def _postToSpeakerJson(baseDir: str, httpPrefix: str,
|
||||||
postShare = os.path.isfile(shareFilename)
|
postShare = os.path.isfile(shareFilename)
|
||||||
|
|
||||||
return _speakerEndpointJson(speakerName, summary,
|
return _speakerEndpointJson(speakerName, summary,
|
||||||
content, imageDescription,
|
content, sayContent, imageDescription,
|
||||||
detectedLinks, gender, postId,
|
detectedLinks, gender, postId,
|
||||||
postDM, postReply,
|
postDM, postReply,
|
||||||
followRequestsExist,
|
followRequestsExist,
|
||||||
|
|
Loading…
Reference in New Issue