Replace remote hashtag links in ssml

merge-requests/30/head
Bob Mottram 2023-01-06 17:51:45 +00:00
parent bfda87789f
commit a8f0f8fb70
1 changed files with 4 additions and 2 deletions

View File

@ -28,6 +28,7 @@ from utils import has_object_dict
from utils import acct_dir from utils import acct_dir
from utils import local_actor_url from utils import local_actor_url
from content import html_replace_quote_marks from content import html_replace_quote_marks
from content import replace_remote_hashtags
SPEAKER_REMOVE_CHARS = ('.\n', '. ', ',', ';', '?', '!') SPEAKER_REMOVE_CHARS = ('.\n', '. ', ',', ';', '?', '!')
@ -408,7 +409,7 @@ def speakable_text(base_dir: str, content: str, translate: {}) -> (str, []):
def _post_to_speaker_json(base_dir: str, http_prefix: str, def _post_to_speaker_json(base_dir: str, http_prefix: str,
nickname: str, domain_full: str, nickname: str, domain: str, domain_full: str,
post_json_object: {}, person_cache: {}, post_json_object: {}, person_cache: {},
translate: {}, announcing_actor: str, translate: {}, announcing_actor: str,
theme_name: str) -> {}: theme_name: str) -> {}:
@ -431,6 +432,7 @@ def _post_to_speaker_json(base_dir: str, http_prefix: str,
# replace some emoji before removing html # replace some emoji before removing html
if ' <3' in content: if ' <3' in content:
content = content.replace(' <3', ' ' + translate['heart']) content = content.replace(' <3', ' ' + translate['heart'])
content = replace_remote_hashtags(content, nickname, domain)
content = remove_html(html_replace_quote_marks(content)) content = remove_html(html_replace_quote_marks(content))
content = speaker_replace_links(content, translate, detected_links) content = speaker_replace_links(content, translate, detected_links)
# replace all double spaces # replace all double spaces
@ -551,7 +553,7 @@ def update_speaker(base_dir: str, http_prefix: str,
""" """
speaker_json = \ speaker_json = \
_post_to_speaker_json(base_dir, http_prefix, _post_to_speaker_json(base_dir, http_prefix,
nickname, domain_full, nickname, domain, domain_full,
post_json_object, person_cache, post_json_object, person_cache,
translate, announcing_actor, translate, announcing_actor,
theme_name) theme_name)