dropin

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

commit
0682928e0d49bb7b968067d774445ce28afd70fc
parent
f9c475b9a3adccddbfbb3536e001f6e35f7626ab
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2025-07-26 14:06
restrict both width and height in video media query

Diffstat

M dropin.py 7 +++++++
M templates/video.html 2 +-

2 files changed, 8 insertions, 1 deletions


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

@@ -78,6 +78,13 @@ def duration(value):
   78    78 env.filters['duration'] = duration
   79    79 
   80    80 
   -1    81 def quality_media(quality):
   -1    82     height = int(quality.removesuffix('p'), 10)
   -1    83     width = height * 16 // 9
   -1    84     return f'(min-height: {height}px) and (min-width: {width}px)'
   -1    85 env.filters['quality_media'] = quality_media
   -1    86 
   -1    87 
   81    88 def co2(bytes, green_hosting=0):
   82    89     # https://sustainablewebdesign.org/estimating-digital-emissions/
   83    90 

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

@@ -6,7 +6,7 @@
    6     6     <div class="relative">
    7     7         <video controls poster="{{ video.thumbnail.large }}" preload="none" width="1280" height="720">
    8     8             {% for file in video._embedded.files %}
    9    -1                 <source type="{{ file.mime_type }}" src="/video/{{ video.id }}-{{ file.quality }}.{{ file.format }}" {% if file.quality != 'adaptive' %}media="(min-height: {{ file.quality }}x)" data-quality="{{ file.quality }}" data-co2="{{ file.size.formatted }} (~{{ file.size.bytes|co2 }})"{% endif %}>
   -1     9                 <source type="{{ file.mime_type }}" src="/video/{{ video.id }}-{{ file.quality }}.{{ file.format }}" {% if file.quality != 'adaptive' %}media="{{ file.quality|quality_media }}" data-quality="{{ file.quality }}" data-co2="{{ file.size.formatted }} (~{{ file.size.bytes|co2 }})"{% endif %}>
   10    10             {% endfor %}
   11    11             {% for track in video.tracks.subtitles %}
   12    12                 <track kind="{{ track.kind }}" label="{{ track.label }}" srclang="{{ track.srclang }}" src="{{ track._links.vtt.href }}">