Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Añadir campos al feed RSS y arreglar duración #76

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion radioco/apps/programmes/feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from filebrowser.base import FileObject
from filebrowser.sites import get_default_site

from radioco.apps.global_settings.models import RadiocomConfiguration
from radioco.apps.programmes.models import Programme, Podcast

# TODO:
Expand Down Expand Up @@ -68,14 +69,18 @@ def add_root_elements(self, handler):
'link': self.request.build_absolute_uri(self.programme.get_absolute_url()),
}
)
handler.addQuickElement('itunes:author', RadiocomConfiguration.get_global().station_name)

def add_item_elements(self, handler, item):
super(iTunesFeed, self).add_item_elements(handler, item)

podcast = item["podcast"]
handler.addQuickElement("itunes:subtitle", podcast.episode.title)
handler.addQuickElement("itunes:summary", podcast.episode.summary_text)
handler.addQuickElement("itunes:duration", str(datetime.timedelta(seconds=podcast.duration)))
handler.addQuickElement("itunes:duration", str(datetime.timedelta(minutes=podcast.duration)))
handler.addQuickElement("itunes:season", str(podcast.episode.season))
handler.addQuickElement("itunes:episode", str(podcast.episode.number_in_season))
handler.addQuickElement("guid", str(podcast.episode.id))


class ProgrammeFeed(Feed):
Expand Down