unarr/internal/library
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
..
mediainfo feat(stream): cache extracted subtitles to a hidden .unarr sidecar 2026-06-02 09:10:36 +02:00
cache.go chore: rename module from torrentclaw-cli to unarr 2026-03-30 13:06:07 +02:00
cache_test.go feat: add migrate command, media server detection, and debrid auto-config 2026-03-29 16:54:32 +02:00
delete.go feat(library): add server-driven file deletion with allow_delete config 2026-04-10 16:35:12 +02:00
delete_test.go feat(library): add server-driven file deletion with allow_delete config 2026-04-10 16:35:12 +02:00
paths.go feat(scan): always scan downloads + organize dirs, deduplicate child paths 2026-04-10 11:46:20 +02:00
prewarm.go feat(stream): cache extracted subtitles to a hidden .unarr sidecar 2026-06-02 09:10:36 +02:00
resolve.go fix(library): classify resolution by width + height, not height alone 2026-05-27 11:54:29 +02:00
resolve_test.go fix(library): classify resolution by width + height, not height alone 2026-05-27 11:54:29 +02:00
scanner.go chore: rename module from torrentclaw-cli to unarr 2026-03-30 13:06:07 +02:00
scanner_test.go feat(cli): upgrade command, rich status, and version cache 2026-03-31 22:05:43 +02:00
sync.go fix(library): classify resolution by width + height, not height alone 2026-05-27 11:54:29 +02:00
sync_test.go feat(cli): upgrade command, rich status, and version cache 2026-03-31 22:05:43 +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