Episode names: render MAL titles on the episode grid
anidb's episodes API has no names (id/number/filler only), but the
Jikan call we already make for intro timings carries them (title +
title_japanese). _parse_intros now keeps one entry per episode with
title and optional start/length (entries are never null anymore).
Client: attachEpNames() reuses the introCache promise, stamps
epsList[i].name, re-renders; buttons show the name (3-line clamp) +
full tooltip. Jikan down => no names, no error (same graceful
degradation as the skip-intro button).
Verified headless: Jujutsu Kaisen S1 24/24 buttons named
('E1 | Ryomen Sukuna' ...); S2 (Jikan 504 at the time) rendered
gracefully without names. 17/17 API tests.
This commit is contained in:
1 parent
d60524815f
commit
343628a2e3
4 files changed
+35
-11
No files matched your search
+6
-3
@@ -141,12 +141,15 @@ def _languages(ep_id):
|
||||
|
||||
|
||||
def _parse_intros(eps):
|
||||
"""Jikan episode list -> [{start, length}, ...], None where MAL has no timing"""
|
||||
"""Jikan episode list -> one entry per episode: {title?, start?, length?}.
|
||||
title from MAL (episode name); start/length only when MAL has the timing."""
|
||||
out = []
|
||||
for e in eps:
|
||||
i = e.get("intro") or {}
|
||||
out.append({"start": int(i["start"]), "length": int(i["length"])}
|
||||
if i.get("start") is not None else None)
|
||||
d = {"title": e.get("title") or None}
|
||||
if i.get("start") is not None:
|
||||
d.update(start=int(i["start"]), length=int(i["length"]))
|
||||
out.append(d)
|
||||
return out
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user