- commit
- 0e60a06258629bf3219ec59da1f2f955ec276e50
- parent
- dff3158628700b1f8c3ae27bf76b26e04784e1de
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2025-02-10 03:43
add playlist feed
Diffstat
M | dropin.py | 14 | ++++++++++++++ |
M | templates/collection.html | 6 | ++++++ |
2 files changed, 20 insertions, 0 deletions
diff --git a/dropin.py b/dropin.py
@@ -249,6 +249,19 @@ async def collection_view(request): 249 249 return render_response(request, 'collection.html', **data, items=items) 250 250 251 251 -1 252 async def collection_feed(request): -1 253 if not env.globals.get('ORIGIN'): -1 254 raise web.HTTPNotFound -1 255 id = request.match_info['id'] -1 256 data, items = await asyncio.gather( -1 257 fetch(f'https://api.vhx.tv/collections/{id}'), -1 258 fetch_items(f'https://api.vhx.tv/collections/{id}/items'), -1 259 ) -1 260 tpl = env.get_template('feed.xml') -1 261 body = tpl.render(**data, items=items, request=request) -1 262 return web.Response(body=body, content_type='text/xml') -1 263 -1 264 252 265 async def get_series(id): 253 266 series, _seasons = await asyncio.gather( 254 267 fetch(f'https://api.vhx.tv/collections/{id}'), @@ -342,6 +355,7 @@ if __name__ == '__main__': 342 355 app.router.add_get('/search/', search_view) 343 356 app.router.add_get(r'/movie/{id:\d+}/', collection_view) 344 357 app.router.add_get(r'/playlist/{id:\d+}/', collection_view) -1 358 app.router.add_get(r'/playlist/{id:\d+}.rss', collection_feed) 345 359 app.router.add_get(r'/series/{id:\d+}/', series_view) 346 360 app.router.add_get(r'/series/{id:\d+}.rss', series_feed) 347 361 app.router.add_get(r'/video/{id:\d+}/', video_view)
diff --git a/templates/collection.html b/templates/collection.html
@@ -2,6 +2,12 @@ 2 2 3 3 {% block title %}{{ title }} - {{ super() }}{% endblock %} 4 4 -1 5 {% block head %} -1 6 {% if ORIGIN and type == 'playlist' %} -1 7 <link rel="alternate" type="application/atom+xml" href="/{{ type }}/{{ id }}.rss"> -1 8 {% endif %} -1 9 {% endblock %} -1 10 5 11 {% block content %} 6 12 <div class="wrapper-wide"> 7 13 <h1>{{ title }}</h1>