Intro skip: MAL timings via keyless Jikan + player button
- upstream: _intros(mal_id) -> per-episode {start,length} (seconds),
30d TTL cache; Jikan is down or show uncovered -> [] (no button)
- app: GET /api/intros/{mal_id}, never errors into the player
- player: 'skip intro' pill appears while currentTime is inside the
intro window (+8s grace); click seeks past; reappears if rewound.
Ep-1 intros are often missing in MAL data, so falls back to the
show's first known timing (usually identical across eps)
- test: _parse_intros unit test (Jikan itself is 504ing right now,
live path verified by hand: endpoint returns [] cleanly)
This commit is contained in:
1 parent
c2461f8fba
commit
0613cf7e27
5 files changed
+77
-1
No files matched your search
@@ -296,3 +296,19 @@ def _search_count(user):
|
||||
n = c.execute("SELECT COUNT(*) FROM searches WHERE user=?", (user,)).fetchone()[0]
|
||||
c.close()
|
||||
return n
|
||||
|
||||
|
||||
def test_parse_intros():
|
||||
from server.upstream import _parse_intros
|
||||
out = _parse_intros([
|
||||
{"intro": {"start": 95, "length": 60}},
|
||||
{"intro": {"start": 0, "length": 0}}, # MAL "no intro" marker
|
||||
{"intro": None},
|
||||
{},
|
||||
])
|
||||
assert out == [
|
||||
{"start": 95, "length": 60},
|
||||
{"start": 0, "length": 0},
|
||||
None,
|
||||
None,
|
||||
]
|
||||
Reference in new issue
Block a user