Permalink
Browse files

🐛 fixed iTunes duration for malformed feeds

  • Loading branch information...
Joachim Robert
Joachim Robert committed Nov 28, 2018
1 parent a82a766 commit 75d991a7a5fda4c274506479c04a0f9d711170c1
Showing with 7 additions and 1 deletion.
  1. +7 −1 castrewinder/utils.py
@@ -347,7 +347,13 @@ def build_xml_feed(feed_object, feed_entries, publication_dates, options, feed_f
if image_url[-4:] in ('.jpg', '.png'):
fe.podcast.itunes_image(image_url)
fe.podcast.itunes_duration(episode.get('itunes_duration', ''))
try:
fe.podcast.itunes_duration(episode.get('itunes_duration', ''))
except ValueError:
duration = episode.get('itunes_duration', '')
if duration is not '':
duration = "%s:%s:%s" % (duration[0:2], duration[3:5], duration[6:8])
fe.podcast.itunes_duration(duration)
if feed_format == 'feed_atom':
return fg.atom_str(pretty=True)

0 comments on commit 75d991a

Please sign in to comment.