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

Fetch an external subtitle file for a title/episode and save it locally so
a desktop player can load it (`mpv --sub-file=<path>`).

Anime goes to Jimaku (release-timed JP/EN files, no download quota), with
OpenSubtitles as the English fallback; everything else goes to
OpenSubtitles. Files are kept in their native format — mpv renders .srt and
.ass (with styling) directly, so no VTT conversion is needed.

Files are cached on disk under deterministic names, so replaying a title
never re-downloads (OpenSubtitles has a small daily download quota); stale
cache entries are pruned. Fetching is best-effort by contract: any
exception is caught and returned as an error — a subtitle problem must
never break playback.

# `fetch`

Fetch the best subtitle for the play context in `lang` (ISO 639-1).

`ctx` needs `:type`, `:title`, `:tmdb_id`; optional `:season`, `:episode`,
`:anime`, `:search_title` (the release-name title, e.g. romaji for anime).

Returns `{:ok, path, label}`, `{:error, :no_provider}` when nothing is
configured for this content, or `{:error, reason}`.

---

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