Add batch duplicate review workflow

This commit is contained in:
Philip Guzman
2026-07-01 16:18:30 -07:00
parent 4315d8d4d4
commit f3cfed316d
8 changed files with 391 additions and 36 deletions
+27
View File
@@ -9,6 +9,7 @@ from serato_doctor.web import (
_verified_audio,
analyze_paths,
duplicate_repair,
duplicate_repair_batch,
)
@@ -113,3 +114,29 @@ def test_duplicate_details_include_preview_and_finder_controls(tmp_path):
assert len(group["file_previews"]) == 2
assert group["file_previews"][0]["audio_url"].startswith("/api/audio?")
assert group["file_previews"][0]["reveal_token"]
def test_batch_preview_combines_approved_groups_without_changes(tmp_path):
serato = tmp_path / "_Serato_"
serato.mkdir()
music = tmp_path / "Music"
choices = []
for filename in ("First.mp3", "Second.mp3"):
keeper = music / "A" / filename
duplicate = music / "B" / filename
keeper.parent.mkdir(parents=True, exist_ok=True)
duplicate.parent.mkdir(parents=True, exist_ok=True)
keeper.write_bytes(b"keeper")
duplicate.write_bytes(b"duplicate")
choices.append(
{"keeper": str(keeper), "group_files": [str(keeper), str(duplicate)]}
)
result = duplicate_repair_batch(
serato, music, choices, backup_limit=10
)
assert result["applied"] is False
assert result["choice_count"] == 2
assert len(result["replaced"]) == 2
assert all(not Path(choice["group_files"][1]).is_symlink() for choice in choices)