dropin

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

commit
e34d775c07d2f8cbf23305a1b0f1d878280f9cad
parent
738f5170dc36c81294bc589ddb6f8c5ea78b3885
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2025-02-07 09:32
store ORIGIN in env globals

Diffstat

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

2 files changed, 6 insertions, 7 deletions


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

@@ -15,12 +15,12 @@ from aiohttp import web
   15    15 
   16    16 BASE_DIR = Path(__file__).parent
   17    17 SITE_ID = 36348
   18    -1 ORIGIN = None
   19    18 
   20    19 env = jinja2.Environment(
   21    20     loader=jinja2.FileSystemLoader(BASE_DIR / 'templates'),
   22    21     autoescape=jinja2.select_autoescape(default=True),
   23    22 )
   -1    23 env.globals['FORMATS'] = FORMATS
   24    24 
   25    25 
   26    26 def relative_datetime(value):
@@ -211,12 +211,11 @@ async def series_view(request):
  211   211 
  212   212 
  213   213 async def series_feed(request):
  214    -1     if not ORIGIN:
   -1   214     if not env.globals.get('ORIGIN'):
  215   215         raise web.HTTPNotFound
  216   216     series = await get_series(request.match_info['id'])
  217   217     tpl = env.get_template('feed.xml')
  218    -1     body = tpl.render(**series, origin=ORIGIN)
  219    -1     return web.Response(body=body, content_type='text/xml')
   -1   218     return web.Response(body=tpl.render(**series), content_type='text/xml')
  220   219 
  221   220 
  222   221 async def get_next(data):
@@ -270,7 +269,7 @@ if __name__ == '__main__':
  270   269     parser.add_argument('--origin')
  271   270     args = parser.parse_args()
  272   271 
  273    -1     ORIGIN = args.origin
   -1   272     env.globals['ORIGIN'] = args.origin
  274   273 
  275   274     app = web.Application(middlewares=[
  276   275         web.normalize_path_middleware(),

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

@@ -22,10 +22,10 @@
   22    22                     <itunes:image href="{{ episode.additional_images.aspect_ratio_1_1.medium }}" />
   23    23                     {% if episode.episode_number %}<itunes:episode>{{ episode.episode_number }}</itunes:episode>{% endif%}
   24    24                     {% if episode.season_number %}<itunes:season>{{ episode.season_number }}</itunes:season>{% endif%}
   25    -1                     <enclosure url="{{ origin }}/video/{{ episode.id }}-540p.mp4" length="0" type="video/mp4" />
   -1    25                     <enclosure url="{{ ORIGIN }}/video/{{ episode.id }}-540p.mp4" type="video/mp4" />
   26    26                 </item>
   27    27             {% endfor %}
   28    28         {% endfor %}
   29    -1         <atom:link href="{{ origin }}/series/{{ id }}.rss" rel="self" type="application/rss+xml" />
   -1    29         <atom:link href="{{ ORIGIN }}/series/{{ id }}.rss" rel="self" type="application/rss+xml" />
   30    30     </channel>
   31    31 </rss>