# `Laev.Ratings`
[🔗](https://github.com/alexdont/laev/blob/main/lib/laev/ratings.ex#L1)

Your TMDB ratings, read back as "I have watched this".

A rating is the one unambiguous record of having seen something — nobody
scores a film they haven't watched — and a TMDB account can hold years of them,
imported from IMDb. Reading them in is what makes the rest of laev tell the
truth about a library it never played: titles grey out in search and Featured,
and the stats stop pretending a decade of watching began when laev was
installed.

Marks only. No resume points, no history entries, no sources: laev didn't play
these, and the stats keep them in the off-laev bucket where an assumed runtime
belongs.

# `carry_over_to_mal`

Send progress the TMDB side holds, and MyAnimeList doesn't, to the list.

Anime filed under a TMDB show rather than its MAL entry — laev used to do that
to every Korean and Chinese animation, whose original language isn't Japanese —
was tracked in the wrong place, and the marks were about to be cleared as
stale. Clearing watching is not what they are: they are episodes somebody
watched, and the list has never heard about them.

So they go up first. Only when the cross-id list names exactly one anime for
the show, since several parts means nothing here knows which these episodes
belonged to, and only when the TMDB side is actually ahead. Returns how many
anime were pushed.

# `catch_up`

Bring laev's marks up to the episode count MyAnimeList now holds.

A list keeps a count, not a tick list, so "7 watched" is a claim about seven
episodes — and laev only played one of them. Watching episode 7 of something
you had been watching elsewhere would otherwise leave laev saying 1/13 while
the list says 7/13, and the two would disagree on the page you look at.

Gaps only. A position partway through an episode is somebody's place in it and
is never stamped over. `status` finishing the anime marks the anime itself, so
it leaves the Watchlist the moment the list says it is done.

Returns how many marks were newly written.

# `decide`

What to do with one rated title, given what laev already knows about it.

The only interesting case is the middle one: a part-watched position is
somebody's place in something, and an import must not stamp over it with
"finished" on the strength of a rating that might predate the rewatch.

# `import_from_mal`

Mark your MyAnimeList list watched, in MyAnimeList's own terms.

Anime is not folded into TMDB here. MAL keeps a season as its own entry — "Lupin
III: Part II" is one anime with 155 episodes — and that is exactly what laev
marks: `mal-1425-e12`, an episode of an anime, rather than a season of a show
that happens to contain it. Which means nothing has to be matched to anything:
the list says 24 of 24 watched, and 24 episode marks is what that is. A
part-watched anime marks as far as it got; a one-episode anime (a film, an OVA)
is a single mark, because that is all it is.

Anime laev already had under TMDB ids is cleared on the way through — the same
watching, recorded twice in two numbering schemes, would be counted twice.

Returns `%{marked:, already:, partial:, failed:, finished:, anime:, episodes:,
hours:, cleared:}`.

# `import_from_tmdb`

Mark everything you have rated on TMDB as watched.

Returns `%{marked:, already:, partial:, failed:}`. Idempotent — a second run
marks nothing, because everything is already marked.

`report` is called with progress lines so a long import can speak for itself.

# `marks_for`

The marks one MAL entry stands for: `{episode_marks, whole_anime_mark}`.

A film is only ever the whole thing. A series gets an episode each, and the
whole-anime mark as well once the list calls it completed — which is what makes
it read as finished rather than as a pile of episodes.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
