dropin

alternative frontend for dropout.tv
git clone https://git.ce9e.org/dropin.git

commit
4a0d9339356b07012f9f8c53e0bda5928d37cfc1
parent
212bc61f9270631dee206328ea3c7c400ffbc1f1
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2025-02-10 03:32
more generic feed template

Diffstat

M dropin.py 4 +++-
M templates/feed.xml 42 +++++++++++++++++++++---------------------

2 files changed, 24 insertions, 22 deletions


diff --git a/dropin.py b/dropin.py

@@ -273,8 +273,10 @@ async def series_feed(request):
  273   273     if not env.globals.get('ORIGIN'):
  274   274         raise web.HTTPNotFound
  275   275     series = await get_series(request.match_info['id'])
   -1   276     items = [e for season in series['seasons'] for e in season['episodes']]
  276   277     tpl = env.get_template('feed.xml')
  277    -1     return web.Response(body=tpl.render(**series), content_type='text/xml')
   -1   278     body = tpl.render(**series, items=items, request=request)
   -1   279     return web.Response(body=body, content_type='text/xml')
  278   280 
  279   281 
  280   282 async def get_next(data):

diff --git a/templates/feed.xml b/templates/feed.xml

@@ -10,27 +10,27 @@
   10    10         <podcast:funding url="https://www.dropout.tv">Subscribe</podcast:funding>
   11    11         <itunes:image href="{{ additional_images.aspect_ratio_1_1.medium }}" />
   12    12         <itunes:category text="Comedy" />
   13    -1         {% for season in seasons %}
   14    -1             {% for episode in season.episodes %}
   15    -1                 <item>
   16    -1                     <title>{{ season.title }}: {{ episode.title }}</title>
   17    -1                     <link>{{ episode._links.video_page.href }}</link>
   18    -1                     <guid>{{ episode._links.video_page.href }}</guid>
   19    -1                     <pubDate>{{ episode.created_at }}</pubDate>
   20    -1                     {%+ if description %}<description>{{ episode.description }}</description>{% endif %}
   21    -1                     <itunes:duration>{{ episode.duration.seconds }}</itunes:duration>
   22    -1                     <itunes:image href="{{ episode.additional_images.aspect_ratio_1_1.medium }}" />
   23    -1                     {%+ if episode.episode_number %}<itunes:episode>{{ episode.episode_number }}</itunes:episode>{% endif%}
   24    -1                     {%+ if episode.season_number %}<itunes:season>{{ episode.season_number }}</itunes:season>{% endif%}
   25    -1                     <enclosure url="{{ ORIGIN }}/video/{{ episode.id }}-540p.mp4" type="video/mp4" />
   26    -1                     {% for format, type, quality in FORMATS %}
   27    -1                         <podcast:alternateEnclosure type="{{ type }}" title="{{ quality }}">
   28    -1                             <podcast:source uri="{{ ORIGIN }}/video/{{ episode.id }}-{{ quality }}.{{ format }}" />
   29    -1                         </podcast:alternateEnclosure>
   30    -1                     {% endfor %}
   31    -1                 </item>
   32    -1             {% endfor %}
   -1    13         {% for item in items %}
   -1    14             <item>
   -1    15                 <title>{% if type == 'series' %}{{ item.metadata.season_name }}: {% endif %}{{ item.title }}</title>
   -1    16                 <link>{{ item._links.video_page.href }}</link>
   -1    17                 <guid>{{ item._links.video_page.href }}</guid>
   -1    18                 <pubDate>{{ item.created_at }}</pubDate>
   -1    19                 {%+ if description %}<description>{{ item.description }}</description>{% endif %}
   -1    20                 <itunes:duration>{{ item.duration.seconds }}</itunes:duration>
   -1    21                 <itunes:image href="{{ item.additional_images.aspect_ratio_1_1.medium }}" />
   -1    22                 {% if type == 'series' %}
   -1    23                     {%+ if item.season_number %}<itunes:season>{{ item.season_number }}</itunes:season>{% endif%}
   -1    24                     {%+ if item.episode_number %}<itunes:episode>{{ item.episode_number }}</itunes:episode>{% endif%}
   -1    25                 {% endif %}
   -1    26                 <enclosure url="{{ ORIGIN }}/video/{{ item.id }}-540p.mp4" type="video/mp4" />
   -1    27                 {% for format, type, quality in FORMATS %}
   -1    28                     <podcast:alternateEnclosure type="{{ type }}" title="{{ quality }}">
   -1    29                         <podcast:source uri="{{ ORIGIN }}/video/{{ item.id }}-{{ quality }}.{{ format }}" />
   -1    30                     </podcast:alternateEnclosure>
   -1    31                 {% endfor %}
   -1    32             </item>
   33    33         {% endfor %}
   34    -1         <atom:link href="{{ ORIGIN }}/series/{{ id }}.rss" rel="self" type="application/rss+xml" />
   -1    34         <atom:link href="{{ ORIGIN }}{{ request.path }}" rel="self" type="application/rss+xml" />
   35    35     </channel>
   36    36 </rss>