mirror of https://gitlab.com/bashrc2/epicyon
Podcasts may not have people list
parent
8686a29ac1
commit
d5553fe8a0
|
@ -14071,6 +14071,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
nickname = nickname.split('/')[0]
|
nickname = nickname.split('/')[0]
|
||||||
episode_timestamp = self.path.split('?podepisode=')[1].strip()
|
episode_timestamp = self.path.split('?podepisode=')[1].strip()
|
||||||
episode_timestamp = episode_timestamp.replace('__', ' ')
|
episode_timestamp = episode_timestamp.replace('__', ' ')
|
||||||
|
episode_timestamp = episode_timestamp.replace('aa', ':')
|
||||||
if self.server.newswire.get(episode_timestamp):
|
if self.server.newswire.get(episode_timestamp):
|
||||||
pod_episode = self.server.newswire[episode_timestamp]
|
pod_episode = self.server.newswire[episode_timestamp]
|
||||||
html_str = \
|
html_str = \
|
||||||
|
|
22
newswire.py
22
newswire.py
|
@ -384,9 +384,8 @@ def xml_podcast_to_dict(xml_str: str) -> {}:
|
||||||
See https://github.com/Podcastindex-org/podcast-namespace/
|
See https://github.com/Podcastindex-org/podcast-namespace/
|
||||||
blob/main/docs/1.0.md
|
blob/main/docs/1.0.md
|
||||||
"""
|
"""
|
||||||
if 'podcastindex.org/namespace/1.0' not in xml_str:
|
|
||||||
return {}
|
|
||||||
if '<podcast:' not in xml_str:
|
if '<podcast:' not in xml_str:
|
||||||
|
if '<itunes:' not in xml_str:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
podcast_properties = {
|
podcast_properties = {
|
||||||
|
@ -446,6 +445,7 @@ def xml_podcast_to_dict(xml_str: str) -> {}:
|
||||||
ctr += 1
|
ctr += 1
|
||||||
|
|
||||||
# get the image for the podcast, if it exists
|
# get the image for the podcast, if it exists
|
||||||
|
podcast_episode_image = None
|
||||||
episode_image_tags = ['<itunes:image']
|
episode_image_tags = ['<itunes:image']
|
||||||
for image_tag in episode_image_tags:
|
for image_tag in episode_image_tags:
|
||||||
if image_tag not in xml_str:
|
if image_tag not in xml_str:
|
||||||
|
@ -455,7 +455,7 @@ def xml_podcast_to_dict(xml_str: str) -> {}:
|
||||||
episode_image = episode_image.split('href="')[1]
|
episode_image = episode_image.split('href="')[1]
|
||||||
if '"' in episode_image:
|
if '"' in episode_image:
|
||||||
episode_image = episode_image.split('"')[0]
|
episode_image = episode_image.split('"')[0]
|
||||||
podcast_properties['image'] = episode_image
|
podcast_episode_image = episode_image
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
if '>' in episode_image:
|
if '>' in episode_image:
|
||||||
|
@ -463,8 +463,22 @@ def xml_podcast_to_dict(xml_str: str) -> {}:
|
||||||
if '<' in episode_image:
|
if '<' in episode_image:
|
||||||
episode_image = episode_image.split('<')[0]
|
episode_image = episode_image.split('<')[0]
|
||||||
if '://' in episode_image and '.' in episode_image:
|
if '://' in episode_image and '.' in episode_image:
|
||||||
podcast_properties['image'] = episode_image
|
podcast_episode_image = episode_image
|
||||||
break
|
break
|
||||||
|
|
||||||
|
if podcast_episode_image:
|
||||||
|
podcast_properties['image'] = podcast_episode_image
|
||||||
|
|
||||||
|
if '<itunes:explicit>Y' in xml_str or \
|
||||||
|
'<itunes:explicit>T' in xml_str or \
|
||||||
|
'<itunes:explicit>1' in xml_str:
|
||||||
|
podcast_properties['explicit'] = True
|
||||||
|
else:
|
||||||
|
podcast_properties['explicit'] = False
|
||||||
|
else:
|
||||||
|
if '<podcast:' not in xml_str:
|
||||||
|
return {}
|
||||||
|
|
||||||
return podcast_properties
|
return podcast_properties
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -270,9 +270,10 @@ def _html_newswire(base_dir: str, newswire: {}, nickname: str, moderator: bool,
|
||||||
# change the link url to a podcast episode screen
|
# change the link url to a podcast episode screen
|
||||||
podcast_properties = item[8]
|
podcast_properties = item[8]
|
||||||
if podcast_properties:
|
if podcast_properties:
|
||||||
if podcast_properties.get('persons') and \
|
if podcast_properties.get('image') and \
|
||||||
podcast_properties.get('image'):
|
'explicit' in podcast_properties:
|
||||||
episode_id = date_str.replace(' ', '__')
|
episode_id = date_str.replace(' ', '__')
|
||||||
|
episode_id = episode_id.replace(':', 'aa')
|
||||||
link_url = \
|
link_url = \
|
||||||
'/users/' + nickname + '/?podepisode=' + episode_id
|
'/users/' + nickname + '/?podepisode=' + episode_id
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue