dropin

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

commit
39e87d621ec781c426af01f28fc359c546228e8d
parent
249a26d6f8f29402845fd0c6ab9f3664f62f01cd
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2025-02-06 16:32
add next episode link

Diffstat

M dropout.py 22 +++++++++++++++++++++-
M static/style.css 25 +++++++++++++++++++------
M templates/_list.html 2 +-
M templates/video.html 21 +++++++++++++--------

4 files changed, 54 insertions, 16 deletions


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

@@ -196,13 +196,33 @@ async def series_view(request):
  196   196     return render_response(request, 'series.html', **series, seasons=seasons)
  197   197 
  198   198 
   -1   199 async def get_next(data):
   -1   200     try:
   -1   201         season_id = data['canonical_collection']['id']
   -1   202         episode_number = data['episode_number']
   -1   203         season = await fetch_items(f'https://api.vhx.tv/collections/{season_id}/items')
   -1   204         if episode_number < len(season):
   -1   205             return season[episode_number]['id']
   -1   206 
   -1   207         series_id = data['canonical_collection']['parent']['id']
   -1   208         season_number = data['season_number']
   -1   209         series = await fetch_items(f'https://api.vhx.tv/collections/{series_id}/items')
   -1   210         if season_number < len(series):
   -1   211             season_id = series[season_number]['id']
   -1   212             season = await fetch_items(f'https://api.vhx.tv/collections/{season_id}/items')
   -1   213             return season[0]['id']
   -1   214     except Exception:
   -1   215         return None
   -1   216 
   -1   217 
  199   218 async def video_view(request):
  200   219     id = request.match_info['id']
  201   220     data, files = await asyncio.gather(
  202   221         fetch(f'https://api.vhx.tv/videos/{id}'),
  203   222         fetch(f'https://api.vhx.tv/videos/{id}/files'),
  204   223     )
  205    -1     return render_response(request, 'video.html', **data, files=files)
   -1   224     next = await get_next(data)
   -1   225     return render_response(request, 'video.html', **data, files=files, next=next)
  206   226 
  207   227 
  208   228 async def favicon(request):

diff --git a/static/style.css b/static/style.css

@@ -21,6 +21,7 @@
   21    21 }
   22    22 
   23    23 img {
   -1    24     display: block;
   24    25     max-inline-size: 100%;
   25    26 }
   26    27 
@@ -93,6 +94,7 @@ header {
   93    94     color: var(--fg2);
   94    95 }
   95    96 
   -1    97 .next,
   96    98 .hidden-link {
   97    99     color: inherit;
   98   100     text-decoration: none;
@@ -140,22 +142,33 @@ video {
  140   142     font-size: 110%;
  141   143 }
  142   144 
  143    -1 .thumbnail {
   -1   145 .relative {
  144   146     position: relative;
  145   147 }
  146    -1 .thumbnail img {
  147    -1     display: block;
  148    -1 }
   -1   148 .next,
  149   149 .thumbnail-corner {
  150   150     position: absolute;
  151   151     inset-inline-end: 0.5em;
  152    -1     inset-block-end: 0.5em;
  153   152     background-color: var(--overlay);
  154   153     border-radius: 0.4em;
  155    -1     padding-inline: 0.3em;
   -1   154     padding-inline: 0.5em;
  156   155     padding-block: 0.1em;
  157   156     font-size: 90%;
  158   157 }
   -1   158 .thumbnail-corner {
   -1   159     inset-block-end: 0.5em;
   -1   160 }
   -1   161 .next {
   -1   162     inset-block-start: 0.5em;
   -1   163 }
   -1   164 .next::before {
   -1   165     content: "";
   -1   166     display: inline-block;
   -1   167     border-block: 0.4em solid transparent;
   -1   168     border-inline-start: 0.6em solid currentColor;
   -1   169     border-inline-end: 0;
   -1   170     margin-inline-end: 0.4em;
   -1   171 }
  159   172 
  160   173 .quality {
  161   174     display: flex;

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

@@ -2,7 +2,7 @@
    2     2     {% for item in items %}
    3     3         <li>
    4     4             <a href="/{{ item.type }}/{{ item.id }}/" aria-label="{{ item.title }}">
    5    -1                 <div class="thumbnail">
   -1     5                 <div class="relative">
    6     6                     {% if item.thumbnail %}
    7     7                         <img src="{{ item.thumbnail.small }}" alt="" width="240" height="135" loading="lazy">
    8     8                     {% elif item.thumbnails %}

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

@@ -3,14 +3,19 @@
    3     3 {% block title %}{{ title }} - {{ super() }}{% endblock %}
    4     4 
    5     5 {% block content %}
    6    -1     <video controls poster="{{ thumbnail.large }}" preload="none" crossorigin="anonymous">
    7    -1         {% for file in files %}
    8    -1             <source type="{{ file.mime_type }}" src="{{ file._links.source.href }}" {% if file.quality != 'adaptive' %}media="(min-height: {{ file.quality }}x)"{% endif %} data-quality="{{ file.quality }}">
    9    -1         {% endfor %}
   10    -1         {% for track in tracks.subtitles %}
   11    -1             <track kind="{{ track.kind }}" label="{{ track.label }}" srclang="{{ track.srclang }}" src="{{ track._links.vtt.href }}">
   12    -1         {% endfor %}
   13    -1     </video>
   -1     6     <div class="relative">
   -1     7         <video controls poster="{{ thumbnail.large }}" preload="none" crossorigin="anonymous">
   -1     8             {% for file in files %}
   -1     9                 <source type="{{ file.mime_type }}" src="{{ file._links.source.href }}" {% if file.quality != 'adaptive' %}media="(min-height: {{ file.quality }}x)"{% endif %} data-quality="{{ file.quality }}">
   -1    10             {% endfor %}
   -1    11             {% for track in tracks.subtitles %}
   -1    12                 <track kind="{{ track.kind }}" label="{{ track.label }}" srclang="{{ track.srclang }}" src="{{ track._links.vtt.href }}">
   -1    13             {% endfor %}
   -1    14         </video>
   -1    15         {% if next %}
   -1    16             <a href="/video/{{ next }}/" class="next">Next episode</a>
   -1    17         {% endif %}
   -1    18     </div>
   14    19     <div class="wrapper">
   15    20         <h1>{{ title }}</h1>
   16    21         <div class="meta">