From fa251948964b06f98a308d57c442110e14c577d8 Mon Sep 17 00:00:00 2001 From: Lorenzo Sfienti Date: Mon, 5 Dec 2022 19:07:07 +0100 Subject: [PATCH 1/2] Add itunes:duration --- feedgen/ext/podcast_entry.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/feedgen/ext/podcast_entry.py b/feedgen/ext/podcast_entry.py index 2a3771f..56635ad 100644 --- a/feedgen/ext/podcast_entry.py +++ b/feedgen/ext/podcast_entry.py @@ -30,6 +30,7 @@ def __init__(self): self.__itunes_order = None self.__itunes_subtitle = None self.__itunes_summary = None + self.__itunes_duration = None def extend_rss(self, entry): '''Add additional fields to an RSS item. @@ -77,6 +78,10 @@ def extend_rss(self, entry): if self.__itunes_summary: summary = xml_elem('{%s}summary' % ITUNES_NS, entry) summary.text = self.__itunes_summary + + if self.__itunes_duration: + summary = xml_elem('{%s}duration' % ITUNES_NS, entry) + summary.text = self.__itunes_duration return entry def itunes_author(self, itunes_author=None): @@ -242,3 +247,9 @@ def itunes_summary(self, itunes_summary=None): if itunes_summary is not None: self.__itunes_summary = itunes_summary return self.__itunes_summary + + def itunes_duration(self, itunes_duration=None): + + if itunes_duration is not None: + self.__itunes_duration = itunes_duration + return self.__itunes_duration From c28b49bd3d39ab934437f995d259846cd8cb4674 Mon Sep 17 00:00:00 2001 From: Lorenzo Sfienti Date: Mon, 5 Dec 2022 19:30:02 +0100 Subject: [PATCH 2/2] Remove duplicate itunes_duration --- feedgen/ext/podcast_entry.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/feedgen/ext/podcast_entry.py b/feedgen/ext/podcast_entry.py index 56635ad..714c7dd 100644 --- a/feedgen/ext/podcast_entry.py +++ b/feedgen/ext/podcast_entry.py @@ -30,7 +30,6 @@ def __init__(self): self.__itunes_order = None self.__itunes_subtitle = None self.__itunes_summary = None - self.__itunes_duration = None def extend_rss(self, entry): '''Add additional fields to an RSS item. @@ -79,9 +78,6 @@ def extend_rss(self, entry): summary = xml_elem('{%s}summary' % ITUNES_NS, entry) summary.text = self.__itunes_summary - if self.__itunes_duration: - summary = xml_elem('{%s}duration' % ITUNES_NS, entry) - summary.text = self.__itunes_duration return entry def itunes_author(self, itunes_author=None): @@ -247,9 +243,3 @@ def itunes_summary(self, itunes_summary=None): if itunes_summary is not None: self.__itunes_summary = itunes_summary return self.__itunes_summary - - def itunes_duration(self, itunes_duration=None): - - if itunes_duration is not None: - self.__itunes_duration = itunes_duration - return self.__itunes_duration