dropin

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

commit
2b34d3f9eb284327359fd70aee3c6d160da2622e
parent
ed0a7f2640a376decfac9c03ef7d2d9567688470
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2025-02-07 09:38
hardcode available formats

Diffstat

M dropin.py 16 +++++++++++-----
M templates/feed.xml 5 +++++
M templates/video.html 8 ++------

3 files changed, 18 insertions, 11 deletions


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

@@ -15,6 +15,15 @@ from aiohttp import web
   15    15 
   16    16 BASE_DIR = Path(__file__).parent
   17    17 SITE_ID = 36348
   -1    18 FORMATS = [
   -1    19     ('m3u8', 'application/vnd.apple.mpegurl', 'adaptive'),
   -1    20     ('mpd', 'application/dash+xml', 'adaptive'),
   -1    21     ('mp4', 'video/mp4', '1080p'),
   -1    22     ('mp4', 'video/mp4', '720p'),
   -1    23     ('mp4', 'video/mp4', '540p'),
   -1    24     ('mp4', 'video/mp4', '360p'),
   -1    25     ('mp4', 'video/mp4', '240p'),
   -1    26 ]
   18    27 
   19    28 env = jinja2.Environment(
   20    29     loader=jinja2.FileSystemLoader(BASE_DIR / 'templates'),
@@ -239,12 +248,9 @@ async def get_next(data):
  239   248 
  240   249 async def video_view(request):
  241   250     id = request.match_info['id']
  242    -1     data, files = await asyncio.gather(
  243    -1         fetch(f'https://api.vhx.tv/videos/{id}'),
  244    -1         fetch(f'https://api.vhx.tv/videos/{id}/files'),
  245    -1     )
   -1   251     data = await fetch(f'https://api.vhx.tv/videos/{id}')
  246   252     next = await get_next(data)
  247    -1     return render_response(request, 'video.html', **data, files=files, next=next)
   -1   253     return render_response(request, 'video.html', **data, next=next)
  248   254 
  249   255 
  250   256 async def file_view(request):

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

@@ -23,6 +23,11 @@
   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    25                     <enclosure url="{{ ORIGIN }}/video/{{ episode.id }}-540p.mp4" type="video/mp4" />
   -1    26                     {% for format, type, quality in FORMATS %}
   -1    27                         <podcast:alternateEnclosure type="{{ type }}" title="{{ quality }}">
   -1    28                             <podcast:source uri="{{ ORIGIN }}/video/{{ episode.id }}-{{ quality }}.{{ format }}" />
   -1    29                         </podcast:alternateEnclosure>
   -1    30                     {% endfor %}
   26    31                 </item>
   27    32             {% endfor %}
   28    33         {% endfor %}

diff --git a/templates/video.html b/templates/video.html

@@ -5,12 +5,8 @@
    5     5 {% block content %}
    6     6     <div class="relative">
    7     7         <video controls poster="{{ thumbnail.large }}" preload="none" crossorigin="anonymous">
    8    -1             {% for file in files %}
    9    -1                 {% if file.quality == 'adaptive' %}
   10    -1                     <source type="{{ file.mime_type }}" src="{{ file._links.source.href }}">
   11    -1                 {% else %}
   12    -1                     <source type="{{ file.mime_type }}" src="/video/{{ id }}-{{ file.quality }}.mp4" media="(min-height: {{ file.quality }}x)" data-quality="{{ file.quality }}">
   13    -1                 {% endif %}
   -1     8             {% for format, type, quality in FORMATS %}
   -1     9                 <source type="{{ type }}" src="/video/{{ id }}-{{ quality }}.{{ format }}" {% if quality != 'adaptive' %}media="(min-height: {{ quality }}x)" data-quality="{{ quality }}"{% endif %}>
   14    10             {% endfor %}
   15    11             {% for track in tracks.subtitles %}
   16    12                 <track kind="{{ track.kind }}" label="{{ track.label }}" srclang="{{ track.srclang }}" src="{{ track._links.vtt.href }}">