unarr/internal/library/mediainfo
Deivid Soto 178c16f458 feat(stream): cache extracted subtitles to a hidden .unarr sidecar
On-demand WebVTT extraction re-ran ffmpeg on every /sub request and, for
50GB+ remuxes, couldn't finish a full text track within the 60s HTTP timeout
→ the web player got a 500 and no subtitles.

Extract each text subtitle ONCE — during the library scan (no HTTP deadline,
generous per-file timeout) and write-through on the first on-demand request —
into a hidden ".unarr/<name>.s<index>.vtt" sidecar next to the media file.
The /sub handler serves a fresh sidecar instantly (mtime-invalidated when the
media is replaced), so playback subtitles are instant and huge files work.

- mediainfo.sidecar: cache paths, mtime freshness, atomic write, ExtractSubtitleVTT,
  IsTextSubtitleCodec (shared classifier, mirrors engine + web whitelists).
- library.PrewarmSidecars: bounded, idempotent, ctx-cancellable background pass
  run after every scan (manual + daemon auto-scan).
- subtitleHandler: cache-read → hit; miss → extract → write-through.
- config: library.cache_subtitles (default true), wired via SetCacheSubtitles.

Local-only by design: nothing extracted is uploaded — the sidecar is the user's
own content, private to their disk.
2026-06-02 09:10:36 +02:00
..
ffmpeg.go feat(stream)!: retire WebRTC, HLS-only, bump 0.9.4 2026-05-26 18:04:35 +02:00
ffmpeg_download.go feat(mediainfo): ResolveFFmpeg + DownloadFFmpeg mirroring ffprobe pattern 2026-05-06 09:49:32 +02:00
ffmpeg_test.go feat(mediainfo): ResolveFFmpeg + DownloadFFmpeg mirroring ffprobe pattern 2026-05-06 09:49:32 +02:00
ffprobe.go feat(stream): transcode debrid sources to HLS from a URL (hueco #2/2b) 2026-05-31 16:22:14 +02:00
ffprobe_download.go fix(library): use native arm64 ffprobe on Apple Silicon (osx-arm-64) 2026-04-09 09:26:10 +02:00
ffprobe_download_test.go test(mediainfo): add ffprobe download unit tests 2026-04-06 10:16:27 +02:00
ffprobe_test.go feat(cli): upgrade command, rich status, and version cache 2026-03-31 22:05:43 +02:00
lang.go feat: add migrate command, media server detection, and debrid auto-config 2026-03-29 16:54:32 +02:00
lang_test.go feat: add migrate command, media server detection, and debrid auto-config 2026-03-29 16:54:32 +02:00
sidecar.go feat(stream): cache extracted subtitles to a hidden .unarr sidecar 2026-06-02 09:10:36 +02:00
types.go fix(lint): use default:none to disable errcheck, fix all gofmt and exhaustive 2026-03-31 00:29:16 +02:00