mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of gitlab.com:bashrc2/epicyon
commit
8f83e0918a
|
@ -223,6 +223,10 @@ body, html {
|
||||||
image-rendering: var(--rendering);
|
image-rendering: var(--rendering);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
audio {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
video {
|
video {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
30
newswire.py
30
newswire.py
|
@ -228,6 +228,10 @@ def _add_newswire_dict_entry(base_dir: str, domain: str,
|
||||||
|
|
||||||
# Include tags from podcast categories
|
# Include tags from podcast categories
|
||||||
if podcast_properties:
|
if podcast_properties:
|
||||||
|
if podcast_properties.get('explicit'):
|
||||||
|
if '#NSFW' not in post_tags:
|
||||||
|
post_tags.append('#NSFW')
|
||||||
|
|
||||||
post_tags += podcast_properties['categories']
|
post_tags += podcast_properties['categories']
|
||||||
|
|
||||||
# combine the tags into a single list
|
# combine the tags into a single list
|
||||||
|
@ -568,10 +572,20 @@ def get_link_from_rss_item(rss_item: str) -> (str, str):
|
||||||
if '://' in link:
|
if '://' in link:
|
||||||
return link, mime_type
|
return link, mime_type
|
||||||
|
|
||||||
|
if '<link>' in rss_item and '</link>' in rss_item:
|
||||||
link = rss_item.split('<link>')[1]
|
link = rss_item.split('<link>')[1]
|
||||||
link = link.split('</link>')[0]
|
link = link.split('</link>')[0]
|
||||||
if '://' not in link:
|
if '://' not in link:
|
||||||
return None, None
|
return None, None
|
||||||
|
elif '<link ' in rss_item:
|
||||||
|
link_str = rss_item.split('<link ')[1]
|
||||||
|
if '>' in link_str:
|
||||||
|
link_str = link_str.split('>')[0]
|
||||||
|
if 'href="' in link_str:
|
||||||
|
link_str = link_str.split('href="')[1]
|
||||||
|
if '"' in link_str:
|
||||||
|
link = link_str.split('"')[0]
|
||||||
|
|
||||||
return link, mime_type
|
return link, mime_type
|
||||||
|
|
||||||
|
|
||||||
|
@ -610,9 +624,7 @@ def _xml2str_to_dict(base_dir: str, domain: str, xml_str: str,
|
||||||
continue
|
continue
|
||||||
if '</title>' not in rss_item:
|
if '</title>' not in rss_item:
|
||||||
continue
|
continue
|
||||||
if '<link>' not in rss_item:
|
if '<link' not in rss_item:
|
||||||
continue
|
|
||||||
if '</link>' not in rss_item:
|
|
||||||
continue
|
continue
|
||||||
if '<pubDate>' not in rss_item:
|
if '<pubDate>' not in rss_item:
|
||||||
continue
|
continue
|
||||||
|
@ -709,9 +721,7 @@ def _xml1str_to_dict(base_dir: str, domain: str, xml_str: str,
|
||||||
continue
|
continue
|
||||||
if '</title>' not in rss_item:
|
if '</title>' not in rss_item:
|
||||||
continue
|
continue
|
||||||
if '<link>' not in rss_item:
|
if '<link' not in rss_item:
|
||||||
continue
|
|
||||||
if '</link>' not in rss_item:
|
|
||||||
continue
|
continue
|
||||||
if '<dc:date>' not in rss_item:
|
if '<dc:date>' not in rss_item:
|
||||||
continue
|
continue
|
||||||
|
@ -794,9 +804,7 @@ def _atom_feed_to_dict(base_dir: str, domain: str, xml_str: str,
|
||||||
continue
|
continue
|
||||||
if '</title>' not in atom_item:
|
if '</title>' not in atom_item:
|
||||||
continue
|
continue
|
||||||
if '<link>' not in atom_item:
|
if '<link' not in atom_item:
|
||||||
continue
|
|
||||||
if '</link>' not in atom_item:
|
|
||||||
continue
|
continue
|
||||||
if '<updated>' not in atom_item:
|
if '<updated>' not in atom_item:
|
||||||
continue
|
continue
|
||||||
|
@ -980,7 +988,11 @@ def _atom_feed_yt_to_dict(base_dir: str, domain: str, xml_str: str,
|
||||||
atom_items = xml_str.split('<entry>')
|
atom_items = xml_str.split('<entry>')
|
||||||
post_ctr = 0
|
post_ctr = 0
|
||||||
max_bytes = max_feed_item_size_kb * 1024
|
max_bytes = max_feed_item_size_kb * 1024
|
||||||
|
first_entry = True
|
||||||
for atom_item in atom_items:
|
for atom_item in atom_items:
|
||||||
|
if first_entry:
|
||||||
|
first_entry = False
|
||||||
|
continue
|
||||||
if not atom_item:
|
if not atom_item:
|
||||||
continue
|
continue
|
||||||
if not atom_item.strip():
|
if not atom_item.strip():
|
||||||
|
|
10
tests.py
10
tests.py
|
@ -6477,6 +6477,16 @@ def _test_get_link_from_rss_item() -> None:
|
||||||
assert link.startswith('https://anchor.fm')
|
assert link.startswith('https://anchor.fm')
|
||||||
assert not mime_type
|
assert not mime_type
|
||||||
|
|
||||||
|
rss_item = \
|
||||||
|
'<link href="' + \
|
||||||
|
'https://test.link/creativecommons/episodes/' + \
|
||||||
|
'Hessel-van-Oorschot-of-Tribe-of-Noise--Free-Music-Archive-e1crvce' + \
|
||||||
|
'"/>' + \
|
||||||
|
'<pubDate>Wed, 12 Jan 2022 14:28:46 GMT</pubDate>'
|
||||||
|
link, mime_type = get_link_from_rss_item(rss_item)
|
||||||
|
assert link
|
||||||
|
assert link.startswith('https://test.link/creativecommons')
|
||||||
|
|
||||||
|
|
||||||
def run_all_tests():
|
def run_all_tests():
|
||||||
base_dir = os.getcwd()
|
base_dir = os.getcwd()
|
||||||
|
|
|
@ -23,6 +23,8 @@ from webapp_utils import html_keyboard_navigation
|
||||||
def _html_podcast_performers(podcast_properties: {}) -> str:
|
def _html_podcast_performers(podcast_properties: {}) -> str:
|
||||||
"""Returns html for performers of a podcast
|
"""Returns html for performers of a podcast
|
||||||
"""
|
"""
|
||||||
|
if not podcast_properties:
|
||||||
|
return ''
|
||||||
if not podcast_properties.get('persons'):
|
if not podcast_properties.get('persons'):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
@ -72,6 +74,8 @@ def _html_podcast_soundbites(link_url: str, extension: str,
|
||||||
translate: {}) -> str:
|
translate: {}) -> str:
|
||||||
"""Returns html for podcast soundbites
|
"""Returns html for podcast soundbites
|
||||||
"""
|
"""
|
||||||
|
if not podcast_properties:
|
||||||
|
return ''
|
||||||
if not podcast_properties.get('soundbites'):
|
if not podcast_properties.get('soundbites'):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue