Laev.Anime (laev v0.1.40)

Copy Markdown View Source

What laev knows about an anime, as MyAnimeList counts it.

Anime is tracked on its own terms here, not folded into TMDB's. MAL keeps a season as its own entry — "Lupin III: Part II" is one anime, with 155 episodes and a length of its own — and that is the unit laev marks, counts and times anime in: a mark is mal-1425-e12, never a season of a TMDB show that happens to contain it.

This is the small amount of detail those marks need to mean anything: the title to show, how many episodes there are, and how long one runs. It comes from the same list request the import already makes, so a full import leaves every anime on the list described, and nothing else ever has to ask. An anime laev plays that the list didn't cover is fetched once and kept.

Summary

Functions

Everything known, as %{mal_id => fields} with atom keys.

How many episodes the anime has, or nil.

What's known about one anime, or nil.

Make sure this anime is described, asking MAL once if it isn't.

Remember a map of mal_id => %{title:, episodes:, seconds:, status:, score:}.

Change the status laev has for an anime — "on_hold", "watching", "completed".

The anime's title, or nil — never a fetch.

Functions

all()

Everything known, as %{mal_id => fields} with atom keys.

episodes(mal_id)

How many episodes the anime has, or nil.

Read from the list, so it answers offline — which is what lets the home screen know a finished anime has no next episode without asking anyone.

get(mal_id)

What's known about one anime, or nil.

learn(mal_id)

Make sure this anime is described, asking MAL once if it isn't.

Called where a pause is already expected — after a play, during an import — never from a list.

put_many(entries)

Remember a map of mal_id => %{title:, episodes:, seconds:, status:, score:}.

set_status(mal_id, status)

Change the status laev has for an anime — "on_hold", "watching", "completed".

Written after laev tells MyAnimeList the same thing, so the page you are looking at is right immediately instead of at the next import.

title(mal_id)

The anime's title, or nil — never a fetch.