Laev.Seasons (laev v0.1.40)

Copy Markdown View Source

How many episodes of a season have actually aired.

Written whenever laev asks TMDB about a season — which it does every time you pick or play an episode — and read where asking is not an option: the home screen, which never fetches, and which was offering episode 10 of a nine-episode season on the strength of adding one and hoping.

Small and disposable. A wrong answer here only costs the Up Next row, so an unknown season is treated as "maybe", and the file can be deleted without consequence.

Summary

Functions

Episodes aired in this season, or nil when laev has never looked.

Aired seasons for a show, or nil when laev has never looked.

Remember how many episodes of this season are out.

How many of a show's seasons have actually aired — TMDB lists the announced ones too, and they are not something you can be behind on.

The same for many shows at once, in one write.

Functions

aired(tv_id, season)

Episodes aired in this season, or nil when laev has never looked.

aired_seasons(tv_id)

Aired seasons for a show, or nil when laev has never looked.

put(tv_id, season, aired)

Remember how many episodes of this season are out.

put_aired_seasons(tv_id, count)

How many of a show's seasons have actually aired — TMDB lists the announced ones too, and they are not something you can be behind on.

Written whenever a screen fetches a show's details, and read by the home screen, which fetches nothing: it is how the count of shows to finish can leave out the ones you are merely waiting on.

put_aired_seasons_many(counts)

The same for many shows at once, in one write.

Which is the only safe way to do it from concurrent work: every writer here reads the whole file, changes a key and writes it back, so eight tasks saving one show each keep one of the eight. The screen that fetches a page of shows collects them and saves once.