Add defensible orphaned audio detection
This commit is contained in:
@@ -2,6 +2,7 @@ from pathlib import Path
|
||||
|
||||
from serato_doctor.health import analyze_health
|
||||
from serato_doctor.models.crate import Crate, CrateKind
|
||||
from serato_doctor.models.database import DatabaseTrack, SeratoDatabase
|
||||
from serato_doctor.models.filesystem import BrokenSymlink
|
||||
from serato_doctor.models.library import Library
|
||||
from serato_doctor.models.reference import TrackReference
|
||||
@@ -49,6 +50,7 @@ def test_health_report_exposes_each_metric():
|
||||
assert report.duplicate_filename_groups == 1
|
||||
assert report.duplicate_files == 1
|
||||
assert report.unused_tracks == 3
|
||||
assert report.orphan_candidates is None
|
||||
assert report.suggested_matches == 1
|
||||
|
||||
|
||||
@@ -60,6 +62,32 @@ def test_empty_library_has_no_health_score():
|
||||
assert report.scored_references == 0
|
||||
assert not report.database_present
|
||||
assert report.tracks_missing_from_database == 0
|
||||
assert report.orphan_candidates is None
|
||||
|
||||
|
||||
def test_orphan_candidates_exclude_tracks_known_to_serato_or_crates():
|
||||
tracks = [
|
||||
track("Crated.mp3"),
|
||||
track("LibraryOnly.mp3"),
|
||||
track("OutsideEverything.mp3"),
|
||||
]
|
||||
database = SeratoDatabase(
|
||||
Path("database V2"),
|
||||
"test",
|
||||
(
|
||||
DatabaseTrack(
|
||||
Path("/new/House/LibraryOnly.mp3"), "LibraryOnly.mp3"
|
||||
),
|
||||
),
|
||||
)
|
||||
library = Library.build(
|
||||
[reference("Crated.mp3")], tracks, database=database
|
||||
)
|
||||
|
||||
report = analyze_health(library)
|
||||
|
||||
assert report.unused_tracks == 2
|
||||
assert report.orphan_candidates == 1
|
||||
|
||||
|
||||
def test_smart_crate_references_are_reported_but_not_scored():
|
||||
|
||||
Reference in New Issue
Block a user