unarr/internal/library
Deivid Soto b6ddeea129 feat(library): content fingerprint + path-resilient sync + stream self-heal
Stop treating the absolute path as a file's identity so a base-path change
(host binary→docker remap, moved media folder, remount) no longer makes the
server duplicate and orphan library rows.

- fingerprint.go: ComputeFingerprint = sha256(size ‖ first 1MiB ‖ last 1MiB),
  a stable content identity that survives rename/move/base-path change. Cached
  in LibraryItem and reused on incremental scans when size+mtime are unchanged.
- sync: send fingerprint + rel_path (relative to the scan root) + agent_id in
  the library-sync request, so the server can move a row in place and scope
  stale-cleanup per agent.
- daemon: force a FULL re-scan (with a user-facing WARNING) when the scan root
  changed since the last cache, so the server re-maps by fingerprint instead of
  duplicating. basePathChanged compares filepath.Clean'd roots.
- daemon: relocateUnreachable self-heals a stream request whose path is under an
  old root but whose file still exists under a current allowed root, so playback
  works immediately without waiting for the re-scan. Conservative: requires a
  3-segment tail and re-checks containment after resolving symlinks so it can
  neither serve the wrong file nor escape the allowed dirs.

See docs/plans/unarr-path-resilience.md in the web repo.
2026-06-03 12:08:58 +02:00
..
mediainfo feat(library): detect corrupt/incomplete files during scan 2026-06-02 19:42:00 +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
fingerprint.go feat(library): content fingerprint + path-resilient sync + stream self-heal 2026-06-03 12:08:58 +02:00
fingerprint_test.go feat(library): content fingerprint + path-resilient sync + stream self-heal 2026-06-03 12:08:58 +02:00
paths.go feat(scan): always scan downloads + organize dirs, deduplicate child paths 2026-04-10 11:46:20 +02:00
prewarm.go fix(stream): /critico review fixes for the sidecar cache 2026-06-02 13:46:07 +02:00
prewarm_test.go fix(stream): /critico review fixes for the sidecar cache 2026-06-02 13:46:07 +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 feat(library): content fingerprint + path-resilient sync + stream self-heal 2026-06-03 12:08:58 +02:00
scanner_test.go feat(cli): upgrade command, rich status, and version cache 2026-03-31 22:05:43 +02:00
sync.go feat(library): content fingerprint + path-resilient sync + stream self-heal 2026-06-03 12:08:58 +02:00
sync_test.go feat(cli): upgrade command, rich status, and version cache 2026-03-31 22:05:43 +02:00
types.go feat(library): content fingerprint + path-resilient sync + stream self-heal 2026-06-03 12:08:58 +02:00