Laev.Days (laev v0.1.40)

Copy Markdown View Source

How much was watched on each day.

The mpv script appends a line every few seconds while something plays — 2026-09-25 5 — which is the only record of when watching happened. Nothing else has it: a position file holds a second within an episode, and its mtime is no help because a sync pull rewrites every one of them at once.

Append-only on purpose. The player writes it, so the record survives laev being closed, mpv being killed and the machine losing power, none of which the escript would be around to record. The cost is a line every five seconds, so the file is folded back into one line per day whenever it gets long — reading it gives the same answer either way.

Summary

Functions

The last days days as a list of {date, seconds}, oldest first, with the quiet days present and zero — a heatmap needs the gaps as much as the marks.

Longest run of consecutive days with something watched, up to today.

Today by the wall clock, not UTC.

Seconds watched per day, as %{~D[2026-09-25] => 7320}. Unparsable lines are skipped rather than fatal — it is a log, not a database.

Functions

recent(days)

The last days days as a list of {date, seconds}, oldest first, with the quiet days present and zero — a heatmap needs the gaps as much as the marks.

streak(day_list)

Longest run of consecutive days with something watched, up to today.

today()

Today by the wall clock, not UTC.

The player stamps its lines with the local date, so the grid has to agree: read in UTC, an evening after midnight local would land on a day the renderer never draws.

totals()

Seconds watched per day, as %{~D[2026-09-25] => 7320}. Unparsable lines are skipped rather than fatal — it is a log, not a database.