Unescape podcast description

main
Bob Mottram 2022-01-12 19:40:12 +00:00
parent c7e030d0c6
commit 3d175fc5d1
2 changed files with 35 additions and 35 deletions

View File

@ -538,21 +538,21 @@ def _create_news_mirror(base_dir: str, domain: str,
return True return True
def _convert_rs_sto_activity_pub(base_dir: str, http_prefix: str, def _convert_rss_to_activitypub(base_dir: str, http_prefix: str,
domain: str, port: int, domain: str, port: int,
newswire: {}, newswire: {},
translate: {}, translate: {},
recent_posts_cache: {}, recent_posts_cache: {},
max_recent_posts: int, max_recent_posts: int,
session, cached_webfingers: {}, session, cached_webfingers: {},
person_cache: {}, person_cache: {},
federation_list: [], federation_list: [],
send_threads: [], post_log: [], send_threads: [], post_log: [],
max_mirrored_articles: int, max_mirrored_articles: int,
allow_local_network_access: bool, allow_local_network_access: bool,
system_language: str, system_language: str,
low_bandwidth: bool, low_bandwidth: bool,
content_license_url: str) -> None: content_license_url: str) -> None:
"""Converts rss items in a newswire into posts """Converts rss items in a newswire into posts
""" """
if not newswire: if not newswire:
@ -755,7 +755,7 @@ def _convert_rs_sto_activity_pub(base_dir: str, http_prefix: str,
try: try:
os.remove(filename + '.arrived') os.remove(filename + '.arrived')
except OSError: except OSError:
print('EX: _convert_rs_sto_activity_pub ' + print('EX: _convert_rss_to_activitypub ' +
'unable to delete ' + filename + '.arrived') 'unable to delete ' + filename + '.arrived')
# setting the url here links to the activitypub object # setting the url here links to the activitypub object
@ -833,22 +833,22 @@ def run_newswire_daemon(base_dir: str, httpd,
print('No new newswire') print('No new newswire')
print('Converting newswire to activitypub format') print('Converting newswire to activitypub format')
_convert_rs_sto_activity_pub(base_dir, _convert_rss_to_activitypub(base_dir,
http_prefix, domain, port, http_prefix, domain, port,
new_newswire, translate, new_newswire, translate,
httpd.recent_posts_cache, httpd.recent_posts_cache,
httpd.max_recent_posts, httpd.max_recent_posts,
httpd.session, httpd.session,
httpd.cached_webfingers, httpd.cached_webfingers,
httpd.person_cache, httpd.person_cache,
httpd.federation_list, httpd.federation_list,
httpd.send_threads, httpd.send_threads,
httpd.postLog, httpd.postLog,
httpd.max_mirrored_articles, httpd.max_mirrored_articles,
httpd.allow_local_network_access, httpd.allow_local_network_access,
httpd.system_language, httpd.system_language,
httpd.low_bandwidth, httpd.low_bandwidth,
httpd.content_license_url) httpd.content_license_url)
print('Newswire feed converted to ActivityPub') print('Newswire feed converted to ActivityPub')
if httpd.max_news_posts > 0: if httpd.max_news_posts > 0:

View File

@ -8,7 +8,7 @@ __status__ = "Production"
__module_group__ = "Web Interface Columns" __module_group__ = "Web Interface Columns"
import os import os
import urllib.parse import html
from shutil import copyfile from shutil import copyfile
from utils import get_config_param from utils import get_config_param
from utils import remove_html from utils import remove_html
@ -184,14 +184,14 @@ def html_podcast_episode(css_cache: {}, translate: {},
translate['Your browser does not support the audio element.'] + \ translate['Your browser does not support the audio element.'] + \
'\n </audio>\n' '\n </audio>\n'
podcast_title = remove_html(urllib.parse.unquote_plus(newswire_item[0])) podcast_title = remove_html(html.unescape(newswire_item[0]))
if podcast_title: if podcast_title:
podcast_str += \ podcast_str += \
'<p><label class="podcast-title">"' + podcast_title + \ '<p><label class="podcast-title">"' + podcast_title + \
'</label></p>\n' '</label></p>\n'
if newswire_item[4]: if newswire_item[4]:
podcast_description = \ podcast_description = \
remove_html(urllib.parse.unquote_plus(newswire_item[4])) remove_html(html.unescape(newswire_item[4]))
if podcast_description: if podcast_description:
podcast_str += '<p>' + podcast_description + '</p>\n' podcast_str += '<p>' + podcast_description + '</p>\n'