Laev.NowPlaying (laev v0.1.40)

Copy Markdown View Source

Whether mpv is still playing something laev started, and what.

mpv is launched detached, so laev can leave its Now Playing page — esc goes back to the menu and the film keeps running. That is the whole point, but it used to be one-way: nothing led back, and the page holds the things you want mid-film (rate it, switch source, queue the next episode).

A launch records what it started; liveness is read back from the tracker's own heartbeat. The mpv script rewrites played/<key> every 5 seconds for as long as the player is up — pause included, since a paused mpv still reports a position — so a recent write means mpv is alive, and nothing to write means it is gone. That file is deliberately the signal rather than the position file: positions are synced, and a sync pull rewrites all of them at once, which would make every title look like it just played.

Summary

Functions

Forget it — the player is gone, or the user quit laev with it.

What mpv is playing right now as {ctx, stream}, or nil when nothing is.

Record what was just launched. Best-effort: never breaks playback.

Functions

clear()

Forget it — the player is gone, or the user quit laev with it.

current()

What mpv is playing right now as {ctx, stream}, or nil when nothing is.

The stream half can be all nils for a play recorded before this existed; the page copes, because everything but "replay" works from the context.

mark(ctx, stream)

Record what was just launched. Best-effort: never breaks playback.