mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
3a0079d03d
commit
ac6695b9f3
|
@ -324,7 +324,7 @@ def _save_custom_emoji(session, base_dir: str, emojiName: str, url: str,
|
||||||
if not os.path.isdir(custom_emoji_dir):
|
if not os.path.isdir(custom_emoji_dir):
|
||||||
os.mkdir(custom_emoji_dir)
|
os.mkdir(custom_emoji_dir)
|
||||||
emoji_image_filename = custom_emoji_dir + '/' + emojiName + '.' + ext
|
emoji_image_filename = custom_emoji_dir + '/' + emojiName + '.' + ext
|
||||||
if not download_image(session, base_dir, url,
|
if not download_image(session, url,
|
||||||
emoji_image_filename, debug, False):
|
emoji_image_filename, debug, False):
|
||||||
if debug:
|
if debug:
|
||||||
print('EX: custom emoji not downloaded ' + url)
|
print('EX: custom emoji not downloaded ' + url)
|
||||||
|
@ -1573,7 +1573,7 @@ def import_emoji(base_dir: str, import_filename: str, session) -> None:
|
||||||
emoji_image_filename = base_dir + '/emoji/' + tag + '.png'
|
emoji_image_filename = base_dir + '/emoji/' + tag + '.png'
|
||||||
if os.path.isfile(emoji_image_filename):
|
if os.path.isfile(emoji_image_filename):
|
||||||
continue
|
continue
|
||||||
if download_image(session, base_dir, url,
|
if download_image(session, url,
|
||||||
emoji_image_filename, True, False):
|
emoji_image_filename, True, False):
|
||||||
emoji_dict[tag] = tag
|
emoji_dict[tag] = tag
|
||||||
added += 1
|
added += 1
|
||||||
|
|
2
inbox.py
2
inbox.py
|
@ -186,7 +186,7 @@ def cache_svg_images(session, base_dir: str, http_prefix: str,
|
||||||
if not test_image_filename:
|
if not test_image_filename:
|
||||||
image_filename = \
|
image_filename = \
|
||||||
base_dir + '/media/' + post_id + '_' + filename
|
base_dir + '/media/' + post_id + '_' + filename
|
||||||
if not download_image(session, base_dir, url,
|
if not download_image(session, url,
|
||||||
image_filename, debug):
|
image_filename, debug):
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -465,7 +465,7 @@ def post_json(http_prefix: str, domain_full: str,
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def post_json_string(session, post_jsonStr: str,
|
def post_json_string(session, post_json_str: str,
|
||||||
federation_list: [],
|
federation_list: [],
|
||||||
inbox_url: str,
|
inbox_url: str,
|
||||||
headers: {},
|
headers: {},
|
||||||
|
@ -489,7 +489,7 @@ def post_json_string(session, post_jsonStr: str,
|
||||||
|
|
||||||
try:
|
try:
|
||||||
post_result = \
|
post_result = \
|
||||||
session.post(url=inbox_url, data=post_jsonStr,
|
session.post(url=inbox_url, data=post_json_str,
|
||||||
headers=headers, timeout=timeout_sec)
|
headers=headers, timeout=timeout_sec)
|
||||||
except requests.exceptions.RequestException as ex:
|
except requests.exceptions.RequestException as ex:
|
||||||
if not quiet:
|
if not quiet:
|
||||||
|
@ -500,7 +500,7 @@ def post_json_string(session, post_jsonStr: str,
|
||||||
print('EX: connection was reset during post_json_string')
|
print('EX: connection was reset during post_json_string')
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print('EX: post_json_string failed ' + inbox_url + ' ' +
|
print('EX: post_json_string failed ' + inbox_url + ' ' +
|
||||||
post_jsonStr + ' ' + str(headers))
|
post_json_str + ' ' + str(headers))
|
||||||
return None, None, 0
|
return None, None, 0
|
||||||
except ValueError as ex:
|
except ValueError as ex:
|
||||||
if not quiet:
|
if not quiet:
|
||||||
|
@ -592,8 +592,7 @@ def _looks_like_url(url: str) -> bool:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def download_image(session, base_dir: str, url: str,
|
def download_image(session, url: str, image_filename: str, debug: bool,
|
||||||
image_filename: str, debug: bool,
|
|
||||||
force: bool = False) -> bool:
|
force: bool = False) -> bool:
|
||||||
"""Downloads an image with an expected mime type
|
"""Downloads an image with an expected mime type
|
||||||
"""
|
"""
|
||||||
|
|
11
speaker.py
11
speaker.py
|
@ -320,8 +320,7 @@ def _ssml_header(system_language: str, box_name: str, summary: str) -> str:
|
||||||
|
|
||||||
|
|
||||||
def _speaker_endpoint_ssml(display_name: str, summary: str,
|
def _speaker_endpoint_ssml(display_name: str, summary: str,
|
||||||
content: str, image_description: str,
|
content: str, language: str,
|
||||||
links: [], language: str,
|
|
||||||
gender: str, box_name: str) -> str:
|
gender: str, box_name: str) -> str:
|
||||||
"""Returns an SSML endpoint for the TTS speaker
|
"""Returns an SSML endpoint for the TTS speaker
|
||||||
https://en.wikipedia.org/wiki/Speech_Synthesis_Markup_Language
|
https://en.wikipedia.org/wiki/Speech_Synthesis_Markup_Language
|
||||||
|
@ -379,8 +378,6 @@ def get_ssml_box(base_dir: str, path: str,
|
||||||
return _speaker_endpoint_ssml(speaker_json['name'],
|
return _speaker_endpoint_ssml(speaker_json['name'],
|
||||||
speaker_json['summary'],
|
speaker_json['summary'],
|
||||||
speaker_json['say'],
|
speaker_json['say'],
|
||||||
speaker_json['imageDescription'],
|
|
||||||
speaker_json['detectedLinks'],
|
|
||||||
system_language,
|
system_language,
|
||||||
gender, box_name)
|
gender, box_name)
|
||||||
|
|
||||||
|
@ -411,7 +408,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: str, domain_full: str,
|
nickname: 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) -> {}:
|
||||||
|
@ -554,7 +551,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, domain_full,
|
nickname, domain_full,
|
||||||
post_json_object, person_cache,
|
post_json_object, person_cache,
|
||||||
translate, announcing_actor,
|
translate, announcing_actor,
|
||||||
theme_name)
|
theme_name)
|
||||||
|
@ -581,8 +578,6 @@ def update_speaker(base_dir: str, http_prefix: str,
|
||||||
_speaker_endpoint_ssml(speaker_json['name'],
|
_speaker_endpoint_ssml(speaker_json['name'],
|
||||||
speaker_json['summary'],
|
speaker_json['summary'],
|
||||||
speaker_json['say'],
|
speaker_json['say'],
|
||||||
speaker_json['imageDescription'],
|
|
||||||
speaker_json['detectedLinks'],
|
|
||||||
system_language,
|
system_language,
|
||||||
gender, box_name)
|
gender, box_name)
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue