' in xml_str:
@@ -1161,18 +1239,19 @@ def _xml_str_to_dict(base_dir: str, domain: str, xml_str: str,
xml_str, moderated, mirrored,
max_posts_per_source, max_feed_item_size_kb,
max_categories_feedItem_size_kb,
- session, debug)
+ session, debug,
+ preferred_podcast_formats)
if ' {}:
+ max_categories_feedItem_size_kb: int, debug: bool,
+ preferred_podcast_formats: []) -> {}:
"""Returns an RSS url as a dict
"""
if not isinstance(url, str):
@@ -1231,7 +1311,8 @@ def get_rss(base_dir: str, domain: str, session, url: str,
max_posts_per_source,
max_feed_item_size_kb,
max_categories_feedItem_size_kb,
- session, debug)
+ session, debug,
+ preferred_podcast_formats)
else:
print('WARN: feed is too large, ' +
'or contains invalid characters: ' + url)
@@ -1476,7 +1557,8 @@ def get_dict_from_newswire(session, base_dir: str, domain: str,
max_tags: int, max_feed_item_size_kb: int,
max_newswire_posts: int,
max_categories_feedItem_size_kb: int,
- system_language: str, debug: bool) -> {}:
+ system_language: str, debug: bool,
+ preferred_podcast_formats: []) -> {}:
"""Gets rss feeds as a dictionary from newswire file
"""
subscriptions_filename = base_dir + '/accounts/newswire.txt'
@@ -1517,7 +1599,8 @@ def get_dict_from_newswire(session, base_dir: str, domain: str,
moderated, mirrored,
max_posts_per_source, max_feed_size_kb,
max_feed_item_size_kb,
- max_categories_feedItem_size_kb, debug)
+ max_categories_feedItem_size_kb, debug,
+ preferred_podcast_formats)
if items_list:
for date_str, item in items_list.items():
result[date_str] = item
diff --git a/posts.py b/posts.py
index 00befe37d..1f64d3f15 100644
--- a/posts.py
+++ b/posts.py
@@ -1445,7 +1445,7 @@ def _create_post_base(base_dir: str,
if nickname != 'news':
content = \
replace_emoji_from_tags(None, base_dir, content, tags, 'content',
- False)
+ False, True)
# remove replaced emoji
hashtags_dict_copy = hashtags_dict.copy()
for tag_name, tag in hashtags_dict_copy.items():
diff --git a/speaker.py b/speaker.py
index c128ad019..b35a2cd0c 100644
--- a/speaker.py
+++ b/speaker.py
@@ -104,13 +104,17 @@ def _speaker_pronounce(base_dir: str, say_text: str, translate: {}) -> str:
"Tor": "Toor",
"memes": "meemes",
"Memes": "Meemes",
- "rofl": "roll on the floor laughing",
- "ROFL": "roll on the floor laughing",
+ "rofl": translate["laughing"],
+ "ROFL": translate["laughing"],
+ "lmao": translate["laughing"],
+ "LMAO": translate["laughing"],
"fwiw": "for what it's worth",
"fyi": "for your information",
"irl": "in real life",
"IRL": "in real life",
"imho": "in my opinion",
+ "afaik": "as far as I know",
+ "AFAIK": "as far as I know",
"fediverse": "fediiverse",
"Fediverse": "Fediiverse",
" foss ": " free and open source software ",
@@ -124,6 +128,7 @@ def _speaker_pronounce(base_dir: str, say_text: str, translate: {}) -> str:
"#nowplaying": translate["hashtag"] + " now-playing",
"#NowPlaying": translate["hashtag"] + " now-playing",
"#": translate["hashtag"] + ' ',
+ "¯\\_(ツ)_/¯": translate["shrug"],
":D": '. ' + translate["laughing"],
":-D": '. ' + translate["laughing"],
":)": '. ' + translate["smile"],
diff --git a/tests.py b/tests.py
index 35d2cfaa6..f0b1f7bab 100644
--- a/tests.py
+++ b/tests.py
@@ -827,8 +827,10 @@ def create_server_alice(path: str, domain: str, port: int,
dyslexic_font = False
crawlers_allowed = []
check_actor_timeout = 2
+ preferred_podcast_formats = None
print('Server running: Alice')
- run_daemon(check_actor_timeout,
+ run_daemon(preferred_podcast_formats,
+ check_actor_timeout,
crawlers_allowed,
dyslexic_font,
content_license_url,
@@ -984,8 +986,10 @@ def create_server_bob(path: str, domain: str, port: int,
dyslexic_font = False
crawlers_allowed = []
check_actor_timeout = 2
+ preferred_podcast_formats = None
print('Server running: Bob')
- run_daemon(check_actor_timeout,
+ run_daemon(preferred_podcast_formats,
+ check_actor_timeout,
crawlers_allowed,
dyslexic_font,
content_license_url,
@@ -1064,8 +1068,10 @@ def create_server_eve(path: str, domain: str, port: int, federation_list: [],
dyslexic_font = False
crawlers_allowed = []
check_actor_timeout = 2
+ preferred_podcast_formats = None
print('Server running: Eve')
- run_daemon(check_actor_timeout,
+ run_daemon(preferred_podcast_formats,
+ check_actor_timeout,
crawlers_allowed,
dyslexic_font,
content_license_url,
@@ -1146,8 +1152,10 @@ def create_server_group(path: str, domain: str, port: int,
dyslexic_font = False
crawlers_allowed = []
check_actor_timeout = 2
+ preferred_podcast_formats = None
print('Server running: Group')
- run_daemon(check_actor_timeout,
+ run_daemon(preferred_podcast_formats,
+ check_actor_timeout,
crawlers_allowed,
dyslexic_font,
content_license_url,
@@ -3673,9 +3681,23 @@ def _test_addemoji(base_dir: str):
tags.append(tag)
content = content_modified
content_modified = \
- replace_emoji_from_tags(None, base_dir, content, tags, 'content', True)
- # print('content_modified: ' + content_modified)
- assert content_modified == 'Emoji 🍋 🍓 🍌
'
+ replace_emoji_from_tags(None, base_dir, content, tags, 'content',
+ True, True)
+ expected_content = 'Emoji 🍋 🍓 🍌
'
+ if content_modified != expected_content:
+ print('expected_content: ' + expected_content)
+ print('content_modified: ' + content_modified)
+ assert content_modified == expected_content
+ content_modified = \
+ replace_emoji_from_tags(None, base_dir, content, tags, 'content',
+ True, False)
+ expected_content = 'Emoji 🍋' + \
+ ' 🍓 ' + \
+ '🍌
'
+ if content_modified != expected_content:
+ print('expected_content: ' + expected_content)
+ print('content_modified: ' + content_modified)
+ assert content_modified == expected_content
os.chdir(base_dir_original)
shutil.rmtree(base_dir_original + '/.tests',
@@ -6775,31 +6797,74 @@ def _test_xml_podcast_dict(base_dir: str) -> None:
assert len(podcast_properties['locations']) == 1
-def _test_get_link_from_rss_item() -> None:
+def _test_link_from_rss_item() -> None:
print('test_get_link_from_rssitem')
rss_item = \
'' + \
'https://anchor.fm/creativecommons/episodes/' + \
'Hessel-van-Oorschot-of-Tribe-of-Noise--Free-Music-Archive-e1crvce' + \
- '' + \
- 'Wed, 12 Jan 2022 14:28:46 GMT' + \
+ '\n' + \
+ 'Wed, 12 Jan 2022 14:28:46 GMT\n' + \
''
- link, mime_type = get_link_from_rss_item(rss_item)
+ 'ccb5edffbac1.mp3" length="67247880" type="audio/mpeg"/>\n' + \
+ '\n' + \
+ '\n' + \
+ '\n' + \
+ '\n' + \
+ '\n' + \
+ '\n' + \
+ '\n' + \
+ '\n' + \
+ '\n' + \
+ '\n'
+
+ link, mime_type = get_link_from_rss_item(rss_item, None, None)
assert link
- assert link.endswith('.mp3')
+ assert link.endswith('1.mp3')
assert mime_type
assert mime_type == 'audio/mpeg'
+ link, mime_type = get_link_from_rss_item(rss_item, ['audio/mp3'], None)
+ assert link
+ assert link.endswith('1.mp3')
+ assert mime_type
+ assert mime_type == 'audio/mpeg'
+
+ link, mime_type = get_link_from_rss_item(rss_item, ['audio/mpeg'], None)
+ assert link
+ assert link == 'https://whoframed.rodger/rabbit.mp3'
+ assert mime_type
+ assert mime_type == 'audio/mpeg'
+
+ link, mime_type = get_link_from_rss_item(rss_item, ['audio/opus'], None)
+ assert mime_type
+ if mime_type != 'audio/opus':
+ print('mime_type: ' + mime_type)
+ assert mime_type == 'audio/opus'
+ assert link
+ assert link == 'https://whoframed.rodger/rabbit.opus'
+
+ link, mime_type = get_link_from_rss_item(rss_item, ['audio/opus'], 'tor')
+ assert mime_type
+ if mime_type != 'audio/opus':
+ print('mime_type: ' + mime_type)
+ assert mime_type == 'audio/opus'
+ assert link
+ assert link == 'http://randomaddress.onion/rabbit.opus'
+
rss_item = \
'' + \
'https://anchor.fm/creativecommons/episodes/' + \
'Hessel-van-Oorschot-of-Tribe-of-Noise--Free-Music-Archive-e1crvce' + \
'' + \
'Wed, 12 Jan 2022 14:28:46 GMT'
- link, mime_type = get_link_from_rss_item(rss_item)
+ link, mime_type = get_link_from_rss_item(rss_item, None, None)
assert link
assert link.startswith('https://anchor.fm')
assert not mime_type
@@ -6810,7 +6875,7 @@ def _test_get_link_from_rss_item() -> None:
'Hessel-van-Oorschot-of-Tribe-of-Noise--Free-Music-Archive-e1crvce' + \
'"/>' + \
'Wed, 12 Jan 2022 14:28:46 GMT'
- link, mime_type = get_link_from_rss_item(rss_item)
+ link, mime_type = get_link_from_rss_item(rss_item, None, None)
assert link
assert link.startswith('https://test.link/creativecommons')
@@ -7026,7 +7091,7 @@ def run_all_tests():
_test_bold_reading()
_test_published_to_local_timezone()
_test_safe_webtext()
- _test_get_link_from_rss_item()
+ _test_link_from_rss_item()
_test_xml_podcast_dict(base_dir)
_test_get_actor_from_in_reply_to()
_test_valid_emoji_content()
diff --git a/translations/ar.json b/translations/ar.json
index b1e77a64b..e1a2eb44d 100644
--- a/translations/ar.json
+++ b/translations/ar.json
@@ -546,5 +546,6 @@
"lang_sw": "السواحيلية",
"lang_zh": "صينى",
"Common emoji": "الرموز التعبيرية الشائعة",
- "Copy and paste into your text": "نسخ ولصق في النص الخاص بك"
+ "Copy and paste into your text": "نسخ ولصق في النص الخاص بك",
+ "shrug": "هز كتفيه"
}
diff --git a/translations/ca.json b/translations/ca.json
index 1c250ca7e..9d8833dc1 100644
--- a/translations/ca.json
+++ b/translations/ca.json
@@ -546,5 +546,6 @@
"lang_sw": "Suahili",
"lang_zh": "Xinès",
"Common emoji": "Emoji comú",
- "Copy and paste into your text": "Copia i enganxa al teu text"
+ "Copy and paste into your text": "Copia i enganxa al teu text",
+ "shrug": "arronsar les espatlles"
}
diff --git a/translations/cy.json b/translations/cy.json
index 4df858f12..b560e80ff 100644
--- a/translations/cy.json
+++ b/translations/cy.json
@@ -546,5 +546,6 @@
"lang_sw": "Swahili",
"lang_zh": "Tseiniaidd",
"Common emoji": "Emoji cyffredin",
- "Copy and paste into your text": "Copïwch a gludwch i'ch testun"
+ "Copy and paste into your text": "Copïwch a gludwch i'ch testun",
+ "shrug": "shrug"
}
diff --git a/translations/de.json b/translations/de.json
index ebe210e6b..c47cdf0ef 100644
--- a/translations/de.json
+++ b/translations/de.json
@@ -546,5 +546,6 @@
"lang_sw": "Suaheli",
"lang_zh": "Chinesisch",
"Common emoji": "Gewöhnliches Emoji",
- "Copy and paste into your text": "Kopieren und in Ihren Text einfügen"
+ "Copy and paste into your text": "Kopieren und in Ihren Text einfügen",
+ "shrug": "zucken"
}
diff --git a/translations/en.json b/translations/en.json
index 059f1ea90..295551969 100644
--- a/translations/en.json
+++ b/translations/en.json
@@ -546,5 +546,6 @@
"lang_sw": "Swahili",
"lang_zh": "Chinese",
"Common emoji": "Common emoji",
- "Copy and paste into your text": "Copy and paste into your text"
+ "Copy and paste into your text": "Copy and paste into your text",
+ "shrug": "shrug"
}
diff --git a/translations/es.json b/translations/es.json
index 8f8ded93e..861013de4 100644
--- a/translations/es.json
+++ b/translations/es.json
@@ -546,5 +546,6 @@
"lang_sw": "Swahili",
"lang_zh": "China",
"Common emoji": "Emoticonos comunes",
- "Copy and paste into your text": "Copia y pega en tu texto"
+ "Copy and paste into your text": "Copia y pega en tu texto",
+ "shrug": "encogimiento de hombros"
}
diff --git a/translations/fr.json b/translations/fr.json
index 869b5a612..480e522c1 100644
--- a/translations/fr.json
+++ b/translations/fr.json
@@ -546,5 +546,6 @@
"lang_sw": "Swahili",
"lang_zh": "Chinoise",
"Common emoji": "Émoji commun",
- "Copy and paste into your text": "Copiez et collez dans votre texte"
+ "Copy and paste into your text": "Copiez et collez dans votre texte",
+ "shrug": "hausser les épaules"
}
diff --git a/translations/ga.json b/translations/ga.json
index 1b9e61da3..b6fb83e86 100644
--- a/translations/ga.json
+++ b/translations/ga.json
@@ -546,5 +546,6 @@
"lang_sw": "Swahili",
"lang_zh": "Síneach",
"Common emoji": "Emoji coitianta",
- "Copy and paste into your text": "Cóipeáil agus greamaigh isteach i do théacs"
+ "Copy and paste into your text": "Cóipeáil agus greamaigh isteach i do théacs",
+ "shrug": "shrug"
}
diff --git a/translations/hi.json b/translations/hi.json
index 41c166e2b..539f025f8 100644
--- a/translations/hi.json
+++ b/translations/hi.json
@@ -546,5 +546,6 @@
"lang_sw": "Swahili",
"lang_zh": "चीनी",
"Common emoji": "आम इमोजी",
- "Copy and paste into your text": "अपने टेक्स्ट में कॉपी और पेस्ट करें"
+ "Copy and paste into your text": "अपने टेक्स्ट में कॉपी और पेस्ट करें",
+ "shrug": "कंधे उचकाने की क्रिया"
}
diff --git a/translations/it.json b/translations/it.json
index a329d132c..cea417eb7 100644
--- a/translations/it.json
+++ b/translations/it.json
@@ -546,5 +546,6 @@
"lang_sw": "Swahili",
"lang_zh": "Cinese",
"Common emoji": "Emoji comuni",
- "Copy and paste into your text": "Copia e incolla nel tuo testo"
+ "Copy and paste into your text": "Copia e incolla nel tuo testo",
+ "shrug": "scrollare le spalle"
}
diff --git a/translations/ja.json b/translations/ja.json
index c2a12661e..8fe3eea7c 100644
--- a/translations/ja.json
+++ b/translations/ja.json
@@ -546,5 +546,6 @@
"lang_sw": "スワヒリ語",
"lang_zh": "中国語",
"Common emoji": "一般的な絵文字",
- "Copy and paste into your text": "コピーしてテキストに貼り付けます"
+ "Copy and paste into your text": "コピーしてテキストに貼り付けます",
+ "shrug": "肩をすくめる"
}
diff --git a/translations/ko.json b/translations/ko.json
index c9e30c908..dd85895cb 100644
--- a/translations/ko.json
+++ b/translations/ko.json
@@ -546,5 +546,6 @@
"lang_sw": "스와힐리어",
"lang_zh": "중국인",
"Common emoji": "일반적인 이모티콘",
- "Copy and paste into your text": "텍스트에 복사하여 붙여넣기"
+ "Copy and paste into your text": "텍스트에 복사하여 붙여넣기",
+ "shrug": "어깨를 으쓱하다"
}
diff --git a/translations/ku.json b/translations/ku.json
index 920756b66..0c113099f 100644
--- a/translations/ku.json
+++ b/translations/ku.json
@@ -546,5 +546,6 @@
"lang_sw": "Swahîlîyî",
"lang_zh": "Çînî",
"Common emoji": "Emojiyên hevpar",
- "Copy and paste into your text": "Di nivîsa xwe de kopî bikin û bixin"
+ "Copy and paste into your text": "Di nivîsa xwe de kopî bikin û bixin",
+ "shrug": "şuştin"
}
diff --git a/translations/oc.json b/translations/oc.json
index 09b274b18..f11b3c7e3 100644
--- a/translations/oc.json
+++ b/translations/oc.json
@@ -542,5 +542,6 @@
"lang_sw": "Swahili",
"lang_zh": "Chinese",
"Common emoji": "Common emoji",
- "Copy and paste into your text": "Copy and paste into your text"
+ "Copy and paste into your text": "Copy and paste into your text",
+ "shrug": "shrug"
}
diff --git a/translations/pl.json b/translations/pl.json
index f88f3d844..75e7b0d51 100644
--- a/translations/pl.json
+++ b/translations/pl.json
@@ -546,5 +546,6 @@
"lang_sw": "Suahili",
"lang_zh": "Chiński",
"Common emoji": "Popularne emotikony",
- "Copy and paste into your text": "Skopiuj i wklej do swojego tekstu"
+ "Copy and paste into your text": "Skopiuj i wklej do swojego tekstu",
+ "shrug": "wzruszać ramionami"
}
diff --git a/translations/pt.json b/translations/pt.json
index 060083ce1..6654832c2 100644
--- a/translations/pt.json
+++ b/translations/pt.json
@@ -546,5 +546,6 @@
"lang_sw": "Suaíli",
"lang_zh": "Chinês",
"Common emoji": "Emoji comum",
- "Copy and paste into your text": "Copie e cole no seu texto"
+ "Copy and paste into your text": "Copie e cole no seu texto",
+ "shrug": "dar de ombros"
}
diff --git a/translations/ru.json b/translations/ru.json
index 2886a8258..1a5c51bce 100644
--- a/translations/ru.json
+++ b/translations/ru.json
@@ -546,5 +546,6 @@
"lang_sw": "суахили",
"lang_zh": "Китайский",
"Common emoji": "Общие смайлики",
- "Copy and paste into your text": "Скопируйте и вставьте в свой текст"
+ "Copy and paste into your text": "Скопируйте и вставьте в свой текст",
+ "shrug": "пожимание плечами"
}
diff --git a/translations/sw.json b/translations/sw.json
index e7412ba0c..0442893f4 100644
--- a/translations/sw.json
+++ b/translations/sw.json
@@ -546,5 +546,6 @@
"lang_sw": "Kiswahili",
"lang_zh": "Kichina",
"Common emoji": "Emoji ya kawaida",
- "Copy and paste into your text": "Nakili na ubandike kwenye maandishi yako"
+ "Copy and paste into your text": "Nakili na ubandike kwenye maandishi yako",
+ "shrug": "piga mabega"
}
diff --git a/translations/uk.json b/translations/uk.json
index a1afb5f8c..2e285f3c5 100644
--- a/translations/uk.json
+++ b/translations/uk.json
@@ -546,5 +546,6 @@
"lang_sw": "суахілі",
"lang_zh": "китайський",
"Common emoji": "Звичайні емодзі",
- "Copy and paste into your text": "Скопіюйте та вставте у свій текст"
+ "Copy and paste into your text": "Скопіюйте та вставте у свій текст",
+ "shrug": "знизати плечима"
}
diff --git a/translations/zh.json b/translations/zh.json
index 76cc3775c..7c9d98310 100644
--- a/translations/zh.json
+++ b/translations/zh.json
@@ -546,5 +546,6 @@
"lang_sw": "斯瓦希里语",
"lang_zh": "中国人",
"Common emoji": "常见表情符号",
- "Copy and paste into your text": "复制并粘贴到您的文本中"
+ "Copy and paste into your text": "复制并粘贴到您的文本中",
+ "shrug": "耸耸肩"
}
diff --git a/webapp_post.py b/webapp_post.py
index afafe1e4e..4716c3a11 100644
--- a/webapp_post.py
+++ b/webapp_post.py
@@ -2109,7 +2109,7 @@ def individual_post_as_html(signing_priv_key_pem: str,
content_str = \
replace_emoji_from_tags(session, base_dir, content_str,
post_json_object['object']['tag'],
- 'content', False)
+ 'content', False, True)
if is_muted:
content_str = ''
diff --git a/webapp_utils.py b/webapp_utils.py
index b834cc6af..3c57e913b 100644
--- a/webapp_utils.py
+++ b/webapp_utils.py
@@ -984,12 +984,12 @@ def add_emoji_to_display_name(session, base_dir: str, http_prefix: str,
display_name = \
replace_emoji_from_tags(session, base_dir,
display_name, emoji_tags_list,
- 'post header', False)
+ 'post header', False, False)
else:
display_name = \
replace_emoji_from_tags(session, base_dir,
display_name, emoji_tags_list, 'profile',
- False)
+ False, False)
# print('TAG: display_name after tags 2: ' + display_name)
# remove any stray emoji