Laev.Config (laev v0.1.40)

Copy Markdown View Source

Loads provider tokens and API keys into the app env.

Sources, in order of precedence:

  1. Environment variables (RD_TOKEN, TMDB_API_KEY, …)
  2. ~/.config/laev/config — plain KEY=VALUE lines, # comments, same key names as the environment variables.

Summary

Functions

Play the best source instead of asking which one. On unless turned off.

Autoplay the next episode when one ends (LAEV_AUTOPLAY): "off" by default — binge-watching is strictly opt-in ("on" here, --binge, or the post-play menu's autoplay entry).

The currently-set syncable keys, as ENV_KEY => value.

Write restored keys to the config file and into the running app, skipping anything that isn't a key laev recognises. Returns how many were applied.

The ENV_KEY => app-env-atom map for every configurable key.

Preferred audio language for source ranking (LAEV_LANG), default "en".

Whether finishing an anime episode scrobbles to MyAnimeList (LAEV_MAL_SCROBBLE, default on).

The highest resolution to pick automatically — nil for no ceiling.

Which player to hand streams to (LAEV_PLAYER): "mpv" (the default in a terminal), "vlc", or "browser" — the film in the page, which is what a web interface uses unless somebody asks for their own player instead.

The player as an atom, for dispatch.

Poster preview style (LAEV_POSTERS): "auto" (sharp pixel graphics via the terminal's image protocol — the default), "ascii" (colored ASCII glyphs on the terminal's own background), "ascii-bg" (ASCII with painted cell backgrounds), or "off" (no poster previews).

The settings written in a directory, as the names the application uses.

Intro/credits skipping (LAEV_SKIP): "ask" (default — show a Skip button when an intro is detected, skip only on Tab), "auto" (skip immediately), or "off". Detection: AniSkip timestamps for anime + named chapters.

Which keys are configured (by env-var name), for laev config.

Look only at releases within the ceiling, rather than merely preferring them.

True when the user explicitly set LAEV_SUBS.

Subtitle language (LAEV_SUBS): the normalized language code, or nil when disabled ("off"/"none", any case). Defaults to "en" — deliberately NOT LAEV_LANG, which is an audio ranking preference (a ja-audio fan usually still wants English subs unless they say otherwise).

Config keys that a laev key carries between machines.

Upsert KEY=VALUE lines in the config file, leaving everything else — other keys, comments, ordering — as it was. The file holds credentials, so it is kept owner-only.

Functions

auto_source?()

Play the best source instead of asking which one. On unless turned off.

The sources are checked either way — this only decides whether the list is put to the user or the top of it is simply played. On by default because pressing enter on a film and having it start is what people expect; the list is one key away for anyone who wants it, and off is one setting away for anyone who always does.

autoplay?()

Autoplay the next episode when one ends (LAEV_AUTOPLAY): "off" by default — binge-watching is strictly opt-in ("on" here, --binge, or the post-play menu's autoplay entry).

export()

The currently-set syncable keys, as ENV_KEY => value.

import_keys(map)

Write restored keys to the config file and into the running app, skipping anything that isn't a key laev recognises. Returns how many were applied.

keys()

The ENV_KEY => app-env-atom map for every configurable key.

lang()

Preferred audio language for source ranking (LAEV_LANG), default "en".

load()

mal_scrobble?()

Whether finishing an anime episode scrobbles to MyAnimeList (LAEV_MAL_SCROBBLE, default on).

max_resolution()

The highest resolution to pick automatically — nil for no ceiling.

Best does not mean biggest. A 4K remux is 86GB and the wrong answer on a connection that can't carry it or a screen that can't show it, so the automatic pick looks for the best release at or below this and only goes over when there is nothing under it. 1080p by default; the picker still lists everything.

path()

player()

Which player to hand streams to (LAEV_PLAYER): "mpv" (the default in a terminal), "vlc", or "browser" — the film in the page, which is what a web interface uses unless somebody asks for their own player instead.

mpv is the better fit — laev gives it a script that tracks the position from inside the player, skips intros and remembers your audio and subtitle languages — but it isn't everyone's player, and VLC plays the same streams. VLC is followed through its web interface instead, which costs intro skipping and the stinger prompt and nothing else.

player_atom()

The player as an atom, for dispatch.

posters()

Poster preview style (LAEV_POSTERS): "auto" (sharp pixel graphics via the terminal's image protocol — the default), "ascii" (colored ASCII glyphs on the terminal's own background), "ascii-bg" (ASCII with painted cell backgrounds), or "off" (no poster previews).

read_dir(dir)

The settings written in a directory, as the names the application uses.

For building a scope out of what a user has saved, which is the other half of being able to change it: Laev.Scope.load/2 reads this.

skip()

Intro/credits skipping (LAEV_SKIP): "ask" (default — show a Skip button when an intro is detected, skip only on Tab), "auto" (skip immediately), or "off". Detection: AniSkip timestamps for anime + named chapters.

status()

Which keys are configured (by env-var name), for laev config.

strict_resolution?()

Look only at releases within the ceiling, rather than merely preferring them.

Off by default, and the difference matters: normally every release is found and listed, and the ceiling decides only which one starts by itself — so the 4K you didn't want automatically is still one keypress away under "try another source". On, releases above the ceiling are never probed at all, which is what you want when you will never watch them and would rather not spend the check on them.

subs_explicit?()

True when the user explicitly set LAEV_SUBS.

subs_lang()

Subtitle language (LAEV_SUBS): the normalized language code, or nil when disabled ("off"/"none", any case). Defaults to "en" — deliberately NOT LAEV_LANG, which is an audio ranking preference (a ja-audio fan usually still wants English subs unless they say otherwise).

syncable_keys()

Config keys that a laev key carries between machines.

write(pairs)

Upsert KEY=VALUE lines in the config file, leaving everything else — other keys, comments, ordering — as it was. The file holds credentials, so it is kept owner-only.