mirror of https://gitlab.com/bashrc2/epicyon
Show author on podcast screen
parent
b976ae65f6
commit
b1ed807cdf
|
@ -1,3 +1,4 @@
|
|||
37C3
|
||||
Blue
|
||||
Debian
|
||||
Default
|
||||
|
|
29
newswire.py
29
newswire.py
|
@ -478,6 +478,30 @@ def _get_podcast_categories(xml_item: str, xml_str: str) -> str:
|
|||
return podcast_categories
|
||||
|
||||
|
||||
def _get_podcast_author(xml_item: str, xml_str: str) -> str:
|
||||
""" get podcast author if specified.
|
||||
"""
|
||||
author = None
|
||||
episode_author_tags = ['<itunes:author', '<author']
|
||||
|
||||
for author_tag in episode_author_tags:
|
||||
item_str = xml_item
|
||||
if author_tag not in xml_item:
|
||||
if author_tag not in xml_str:
|
||||
continue
|
||||
item_str = xml_str
|
||||
author_str = item_str.split(author_tag)[1]
|
||||
if '>' not in author_str:
|
||||
continue
|
||||
author_str = author_str.split('>')[1]
|
||||
if '<' not in author_str:
|
||||
continue
|
||||
author = item_str.split('>')[0]
|
||||
return remove_html(author).strip()
|
||||
|
||||
return author
|
||||
|
||||
|
||||
def _valid_podcast_entry(base_dir: str, key: str, entry: {}) -> bool:
|
||||
"""Is the given podcast namespace entry valid?
|
||||
https://github.com/Podcastindex-org/podcast-namespace/
|
||||
|
@ -623,6 +647,11 @@ def xml_podcast_to_dict(base_dir: str, xml_item: str, xml_str: str) -> {}:
|
|||
# get categories if they exist. These can be turned into hashtags
|
||||
podcast_categories = _get_podcast_categories(xml_item, xml_str)
|
||||
|
||||
# get the author name
|
||||
podcast_author = _get_podcast_author(xml_item, xml_str)
|
||||
if podcast_author:
|
||||
podcast_properties['author'] = podcast_author
|
||||
|
||||
if podcast_episode_image:
|
||||
podcast_properties['image'] = podcast_episode_image
|
||||
podcast_properties['categories'] = podcast_categories
|
||||
|
|
|
@ -419,6 +419,11 @@ def html_podcast_episode(translate: {},
|
|||
'<span itemprop="headline">' + \
|
||||
podcast_title + \
|
||||
'</span></label></p>\n'
|
||||
|
||||
if podcast_properties.get('author'):
|
||||
author = podcast_properties['author']
|
||||
podcast_str += '<p>' + author + '</p>\n'
|
||||
|
||||
transcripts = _html_podcast_transcripts(podcast_properties, translate)
|
||||
if transcripts:
|
||||
podcast_str += '<p>' + transcripts + '</p>\n'
|
||||
|
|
Loading…
Reference in New Issue