Add thumbnails, name search and a title/image in the Playing tab; keep player controls visible

- Thumbnails (ffmpeg, optional): square crops of images, a frame or poster of
  videos, embedded or folder cover of sounds, cached on disk; /thumb route
  protected by the token like /art. [media] thumbnails = false disables it.
- Name search in the Media tab (server side, accents and case ignored, all
  words required, bounded by result count, scanned entries and time).
- Playing tab: title and picture for files of the library (also when the
  player gives none), and a "last opened file" card when no player runs.
- The player controls and the volume bar never leave the visible area:
  sticky controls and height breakpoints; tests/test_ui_layout.py measures
  13 window sizes in a real Chromium driven over DevTools (tests/uidriver.py).
- Static files are served under /static/<version>/ and pages are revalidated,
  so a tablet no longer keeps an old interface from its heuristic cache.
- Documentation (README fr/en, CLAUDE.md, config.example.toml, make deps).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Denis
2026-10-26 16:28:14 +01:00
parent cd4a8a797b
commit 1de5685338
18 changed files with 1628 additions and 131 deletions
+75
View File
@@ -0,0 +1,75 @@
"""Mise en page de l'onglet Lecture dans un vrai Chromium : rien d'essentiel ne doit être coupé, quelle que soit la taille.
Régression visée : les commandes du lecteur (précédent / lecture / suivant) et la barre de volume sortaient de la zone
visible quand la fenêtre était basse (tablette avec barre de navigateur, téléphone). Ignoré sans Chromium.
"""
import json
import unittest
from aiohttp.test_utils import TestServer
from uidriver import CHROMIUM, Browser, make_app
# (largeur, hauteur) en pixels CSS : tablettes avec ou sans barre de navigateur, portrait, téléphones
SIZES = [(960, 420), (960, 480), (960, 600), (1280, 640), (1280, 800), (800, 1280), (1024, 1366), (600, 960),
(412, 915), (412, 800), (390, 844), (360, 780), (360, 640)]
# Un élément est « visible » s'il est entièrement dans le rectangle qui le contient
VISIBLE = """(() => {
const inside = (el, box) => { const r = el.getBoundingClientRect(); return r.height > 0 && r.top >= box.top - 1 && r.bottom <= box.bottom + 1; };
const byId = (id) => document.getElementById(id);
const zone = document.querySelector('#panel-player .now-playing').getBoundingClientRect();
const panels = document.querySelector('.panels').getBoundingClientRect();
const result = {};
for (const id of ['btn-prev', 'btn-play', 'btn-next', 'seek']) result[id] = inside(byId(id), zone);
result['volume-bar'] = inside(document.querySelector('.volume-bar'), panels);
result['master-volume'] = inside(byId('master-volume'), panels);
return JSON.stringify(result);
})()"""
LAST_CARD = """(() => {
const zone = document.querySelector('#panel-player .empty');
const box = zone.getBoundingClientRect();
const title = document.getElementById('last-title').getBoundingClientRect();
const art = document.querySelector('.last-art').getBoundingClientRect();
return JSON.stringify({title: title.top >= box.top - 1 && title.bottom <= box.bottom + 1, art: art.top >= box.top - 1});
})()"""
@unittest.skipUnless(CHROMIUM, "Chromium is required")
class PlayerLayoutTest(unittest.IsolatedAsyncioTestCase):
async def asyncSetUp(self) -> None:
self.server = TestServer(make_app())
await self.server.start_server()
self.browser = Browser()
await self.browser.start()
async def asyncTearDown(self) -> None:
await self.browser.close()
await self.server.close()
def url(self, scenario: str) -> str:
return f"http://127.0.0.1:{self.server.port}/?token={scenario}"
async def test_player_controls_and_volume_stay_visible(self) -> None:
failures = []
for width, height in SIZES:
await self.browser.open(self.url("player"), width, height)
await self.browser.wait_for("document.getElementById('track-title') && document.getElementById('track-title').textContent !== ''")
visible = json.loads(await self.browser.evaluate(VISIBLE))
failures += [f"{width}x{height}: {name} coupé" for name, ok in visible.items() if not ok]
self.assertEqual(failures, [])
async def test_last_opened_card_is_not_cut_off(self) -> None:
failures = []
for width, height in SIZES:
await self.browser.open(self.url("last"), width, height)
await self.browser.wait_for("document.getElementById('last-title') && document.getElementById('last-title').textContent !== ''")
visible = json.loads(await self.browser.evaluate(LAST_CARD))
failures += [f"{width}x{height}: {name} coupé" for name, ok in visible.items() if not ok]
self.assertEqual(failures, [])
if __name__ == "__main__":
unittest.main()