dropin

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

commit
6464704cca092ab85485d4b087c475e16709508e
parent
ef3855ccf6d99ebdae9e5e70f49a5196063a3922
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2025-02-06 13:10
perf: parallelize some requests

Diffstat

M dropout.py 19 +++++++++++++------

1 files changed, 13 insertions, 6 deletions


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

@@ -173,15 +173,19 @@ async def search_view(request):
  173   173 
  174   174 async def collection_view(request):
  175   175     id = request.match_info['id']
  176    -1     data = await fetch(f'https://api.vhx.tv/collections/{id}')
  177    -1     items = await fetch_items(data['_links']['items']['href'])
   -1   176     data, items = await asyncio.gather(
   -1   177         fetch(f'https://api.vhx.tv/collections/{id}'),
   -1   178         fetch_items(f'https://api.vhx.tv/collections/{id}/items'),
   -1   179     )
  178   180     return render_response(request, 'collection.html', **data, items=items)
  179   181 
  180   182 
  181   183 async def series_view(request):
  182   184     id = request.match_info['id']
  183    -1     series = await fetch(f'https://api.vhx.tv/collections/{id}')
  184    -1     _seasons = await fetch_items(series['_links']['seasons']['href'])
   -1   185     series, _seasons = await asyncio.gather(
   -1   186         fetch(f'https://api.vhx.tv/collections/{id}'),
   -1   187         fetch_items(f'https://api.vhx.tv/collections/{id}/items'),
   -1   188     )
  185   189     season_episodes = await asyncio.gather(*[
  186   190         fetch_items(season['_links']['episodes']['href']) for season in _seasons
  187   191     ])
@@ -193,8 +197,11 @@ async def series_view(request):
  193   197 
  194   198 
  195   199 async def video_view(request):
  196    -1     data = await fetch(f'https://api.vhx.tv/videos/{request.match_info["id"]}')
  197    -1     files = await fetch(data['_links']['files']['href'])
   -1   200     id = request.match_info['id']
   -1   201     data, files = await asyncio.gather(
   -1   202         fetch(f'https://api.vhx.tv/videos/{id}'),
   -1   203         fetch(f'https://api.vhx.tv/videos/{id}/files'),
   -1   204     )
  198   205     return render_response(request, 'video.html', **data, files=files)
  199   206 
  200   207