feat: automate exact dedupe and improve web feedback

This commit is contained in:
OpenClaw Agent
2026-09-18 07:30:38 +08:00
parent 0fbadf0c9c
commit f10e92a5cd
8 changed files with 283 additions and 163 deletions
+21
View File
@@ -0,0 +1,21 @@
from pathlib import Path
from am_deduper.db import connect
from am_deduper.scanner import scan
def test_replacing_file_invalidates_content_hashes(tmp_path: Path):
root = tmp_path / "AllMusic"
(root / "admin").mkdir(parents=True)
path = root / "admin" / "song.flac"
db = root / ".dedupe" / "dedupe.db"
path.write_bytes(b"first" * 1000)
scan(root, db)
with connect(db) as c:
c.execute("UPDATE audio_tracks SET sha256='old-sha', chromaprint='old-fp' WHERE file_path=?", (str(path),))
path.write_bytes(b"second" * 1000)
scan(root, db)
with connect(db) as c:
row = c.execute("SELECT sha256,chromaprint FROM audio_tracks WHERE file_path=?", (str(path),)).fetchone()
assert row["sha256"] is None
assert row["chromaprint"] is None