dropin

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

commit
95d0abdb1233a3ec6e354f20f9c3ba019c1fed2a
parent
b105211b44df46601c11bb90f9608c77d4475dc0
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2025-02-13 08:55
rss: only include a single format in feed

this massively reduces feed size

I have also not yet seen a client who supports alternateEnclosure

Other formats are still available as separate feeds.
See https://podlove.org/podlove-alternate-feeds/

Diffstat

M dropin.py 16 +++++++++++++++-
M templates/feed.xml 12 +++++-------

2 files changed, 20 insertions, 8 deletions


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

@@ -227,8 +227,22 @@ def render_response(request, template, **data):
  227   227 def render_feed(request, col, items):
  228   228     if not env.globals.get('ORIGIN'):
  229   229         raise web.HTTPNotFound
   -1   230 
   -1   231     quality = request.query.get('quality', '540p')
   -1   232     format = request.query.get('format', 'mp4')
   -1   233     types = [t for f, t, q in FORMATS if q == quality and f == format]
   -1   234     if not types:
   -1   235         raise web.HTTPNotFound
   -1   236 
  230   237     tpl = env.get_template('feed.xml')
  231    -1     body = tpl.render(col=col, items=items, request=request)
   -1   238     body = tpl.render(
   -1   239         col=col,
   -1   240         items=items,
   -1   241         request=request,
   -1   242         quality=quality,
   -1   243         format=format,
   -1   244         type=types[0],
   -1   245     )
  232   246     return web.Response(body=body, content_type='text/xml')
  233   247 
  234   248 

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

@@ -23,14 +23,12 @@
   23    23                     {%+ if item.season_number %}<itunes:season>{{ item.season_number }}</itunes:season>{% endif%}
   24    24                     {%+ if item.episode_number %}<itunes:episode>{{ item.episode_number }}</itunes:episode>{% endif%}
   25    25                 {% endif %}
   26    -1                 <enclosure url="{{ ORIGIN }}/video/{{ item.id }}-540p.mp4" type="video/mp4" />
   27    -1                 {% for format, type, quality in FORMATS %}
   28    -1                     <podcast:alternateEnclosure type="{{ type }}" title="{{ quality }}">
   29    -1                         <podcast:source uri="{{ ORIGIN }}/video/{{ item.id }}-{{ quality }}.{{ format }}" />
   30    -1                     </podcast:alternateEnclosure>
   31    -1                 {% endfor %}
   -1    26                 <enclosure url="{{ ORIGIN }}/video/{{ item.id }}-{{ quality }}.{{ format }}" type="{{ type }}" />
   32    27             </item>
   33    28         {% endfor %}
   34    -1         <atom:link href="{{ ORIGIN }}{{ request.path }}" rel="self" type="application/rss+xml" />
   -1    29         <atom:link href="{{ ORIGIN }}{{ request.path }}?format={{ format }}&amp;quality={{ quality }}" rel="self" type="application/rss+xml" />
   -1    30         {% for format, type, quality in FORMATS %}
   -1    31             <atom:link href="{{ ORIGIN }}{{ request.path }}?format={{ format }}&amp;quality={{ quality }}" rel="alternate" type="{{ type }}" title="{{ quality }}"/>
   -1    32         {% endfor %}
   35    33     </channel>
   36    34 </rss>