mirror of https://gitlab.com/bashrc2/epicyon
Use contentMap
parent
39a64844e0
commit
078c7f6320
6
video.py
6
video.py
|
@ -87,7 +87,11 @@ def convert_video_to_note(base_dir: str, nickname: str, domain: str,
|
||||||
post_json_object['license']['name']):
|
post_json_object['license']['name']):
|
||||||
return None
|
return None
|
||||||
content += '<p>' + post_json_object['license']['name'] + '</p>'
|
content += '<p>' + post_json_object['license']['name'] + '</p>'
|
||||||
content += post_json_object['content']
|
post_content = post_json_object['content']
|
||||||
|
if post_json_object.get('contentMap'):
|
||||||
|
if post_json_object['contentMap'].get(system_language):
|
||||||
|
post_content = post_json_object['contentMap'][system_language]
|
||||||
|
content += post_content
|
||||||
|
|
||||||
conversation_id = remove_id_ending(post_json_object['id'])
|
conversation_id = remove_id_ending(post_json_object['id'])
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,8 @@ from blocking import add_cw_from_lists
|
||||||
from reaction import html_emoji_reactions
|
from reaction import html_emoji_reactions
|
||||||
|
|
||||||
|
|
||||||
def _html_post_metadata_open_graph(domain: str, post_json_object: {}) -> str:
|
def _html_post_metadata_open_graph(domain: str, post_json_object: {},
|
||||||
|
system_language: str) -> str:
|
||||||
"""Returns html OpenGraph metadata for a post
|
"""Returns html OpenGraph metadata for a post
|
||||||
"""
|
"""
|
||||||
metadata = \
|
metadata = \
|
||||||
|
@ -122,7 +123,11 @@ def _html_post_metadata_open_graph(domain: str, post_json_object: {}) -> str:
|
||||||
"\" property=\"og:published_time\" />\n"
|
"\" property=\"og:published_time\" />\n"
|
||||||
if not obj_json.get('attachment') or obj_json.get('sensitive'):
|
if not obj_json.get('attachment') or obj_json.get('sensitive'):
|
||||||
if obj_json.get('content') and not obj_json.get('sensitive'):
|
if obj_json.get('content') and not obj_json.get('sensitive'):
|
||||||
description = remove_html(obj_json['content'])
|
obj_content = obj_json['content']
|
||||||
|
if obj_json.get('contentMap'):
|
||||||
|
if obj_json['contentMap'].get(system_language):
|
||||||
|
obj_content = obj_json['contentMap'][system_language]
|
||||||
|
description = remove_html(obj_content)
|
||||||
metadata += \
|
metadata += \
|
||||||
" <meta content=\"" + description + \
|
" <meta content=\"" + description + \
|
||||||
"\" name=\"description\">\n"
|
"\" name=\"description\">\n"
|
||||||
|
@ -150,7 +155,11 @@ def _html_post_metadata_open_graph(domain: str, post_json_object: {}) -> str:
|
||||||
description = 'Attached: 1 audio'
|
description = 'Attached: 1 audio'
|
||||||
if description:
|
if description:
|
||||||
if obj_json.get('content') and not obj_json.get('sensitive'):
|
if obj_json.get('content') and not obj_json.get('sensitive'):
|
||||||
description += '\n\n' + remove_html(obj_json['content'])
|
obj_content = obj_json['content']
|
||||||
|
if obj_json.get('contentMap'):
|
||||||
|
if obj_json['contentMap'].get(system_language):
|
||||||
|
obj_content = obj_json['contentMap'][system_language]
|
||||||
|
description += '\n\n' + remove_html(obj_content)
|
||||||
metadata += \
|
metadata += \
|
||||||
" <meta content=\"" + description + \
|
" <meta content=\"" + description + \
|
||||||
"\" name=\"description\">\n"
|
"\" name=\"description\">\n"
|
||||||
|
@ -2331,7 +2340,8 @@ def html_individual_post(css_cache: {},
|
||||||
|
|
||||||
instance_title = \
|
instance_title = \
|
||||||
get_config_param(base_dir, 'instanceTitle')
|
get_config_param(base_dir, 'instanceTitle')
|
||||||
metadata_str = _html_post_metadata_open_graph(domain, original_post_json)
|
metadata_str = _html_post_metadata_open_graph(domain, original_post_json,
|
||||||
|
system_language)
|
||||||
header_str = html_header_with_external_style(css_filename,
|
header_str = html_header_with_external_style(css_filename,
|
||||||
instance_title, metadata_str)
|
instance_title, metadata_str)
|
||||||
return header_str + post_str + html_footer()
|
return header_str + post_str + html_footer()
|
||||||
|
|
Loading…
Reference in New Issue