Which MyAnimeList entry is which TMDB title.
The two sites count anime differently and share no ids. MAL lists a season as its own entry — "Attack on Titan", "Attack on Titan Season 2" and "Final Season" are three anime with three ids — while TMDB keeps one show with three seasons. Matching them by title is guesswork (sequels, ONAs, recap editions and twelve romanisations of the same name), so laev doesn't: it uses the community cross-id list, which pins each MAL id to a TMDB id and the season number it corresponds to.
The published file is 7.5MB of ids for every site there is. It's fetched once,
trimmed to the two columns laev needs, and kept in anime-map.json — about a
twentieth of the size and loaded in a millisecond. Lookups never reach the
network: a list that pauses to download something is a list that stutters, so
a missing map answers nil and leaves the fetching to ensure/1, which runs
where a pause is expected and explained.
Summary
Functions
The AniDB id for a MAL entry, or nil.
True when this TMDB title is anime — it appears in the cross-id list, which is a list of anime and nothing else.
Make sure the map is present and not stale, fetching it if it isn't.
Drop the in-memory copy, so the next lookup reads the file again.
The Kitsu id for a MAL entry, or nil — Torrentio's anime path is keyed by it.
The MAL id for a TMDB show's season (or a film) — the reverse direction, used to scrobble something laev found on TMDB to the right MAL entry.
Every MAL entry that is part of this TMDB title.
True once the map is on disk (whatever its age).
Fetch the cross-id list and rewrite the trimmed cache.
Where a MAL id lives on TMDB: {"tv", id, season}, {"movie", id}, or nil
when the map doesn't know it (or hasn't been fetched).
Functions
The AniDB id for a MAL entry, or nil.
What AnimeTosho is organized by — with it, an episode search gets the show's whole feed (every episode, every batch) instead of guessing text queries at engines that can't match them. Kitsu's own mapping API misses newer shows; this list doesn't.
True when this TMDB title is anime — it appears in the cross-id list, which is a list of anime and nothing else.
Used to split the stats, so it must answer offline and instantly for every row on the page. An unfetched map calls nothing anime rather than guessing.
Make sure the map is present and not stale, fetching it if it isn't.
Returns {:ok, count} | {:error, reason}. report is called with a line
before a download, so the wait has a reason attached to it.
Drop the in-memory copy, so the next lookup reads the file again.
The Kitsu id for a MAL entry, or nil — Torrentio's anime path is keyed by it.
The MAL id for a TMDB show's season (or a film) — the reverse direction, used to scrobble something laev found on TMDB to the right MAL entry.
Every MAL entry that is part of this TMDB title.
A TMDB show can be many anime: Lupin III is seven entries on MAL and one show with seven seasons here. Which is why laev marks anime by MAL entry — but a search row is still a TMDB row, and this is how it finds out what it is made of.
True once the map is on disk (whatever its age).
Fetch the cross-id list and rewrite the trimmed cache.
Where a MAL id lives on TMDB: {"tv", id, season}, {"movie", id}, or nil
when the map doesn't know it (or hasn't been fetched).
The direction laev needs when something keyed by MAL entry has to find the TMDB title it was played as — forgetting an anime's history, for one.