Permalink
Browse files

Check for episode image file extension

  • Loading branch information...
Joachim
Joachim committed Jul 12, 2018
1 parent 43909f5 commit e81da9bff32a41bfadd5f20a5c4a8d97189bb8d7
Showing with 9 additions and 2 deletions.
  1. +9 −2 castrewinder/utils.py
@@ -220,6 +220,7 @@ def build_feed(feed_object, feed_entries, publication_dates, feed_format='feed_r
if 'image' in feed and 'href' in feed['image']:
fg.logo(feed['image']['href'])
fg.language(feed['language'] if 'language' in feed else '')
fg.rights(feed['rights'] if 'rights' in feed else '')
fg.generator('Cast Rewinder & python-feedgen on %s' % request.host_url)
@@ -286,8 +287,14 @@ def build_feed(feed_object, feed_entries, publication_dates, feed_format='feed_r
type = link['type'] if 'type' in link else '',
length = link['length'] if 'length' in link else '')
if 'image' in episode:
fe.podcast.itunes_image(episode['image']['href'])
if 'image' in episode and 'href' in episode['image']:
image_url = episode['image']['href']
if image_url.rfind('?') > 0:
image_url = image_url[:image_url.rfind('?')]
if image_url[-4:] in ('.jpg', '.png'):
fe.podcast.itunes_image(image_url)
fe.podcast.itunes_duration(episode['itunes_duration'] if 'itunes_duration' in episode else '')

0 comments on commit e81da9b

Please sign in to comment.