Introduce core library model

This commit is contained in:
Philip Guzman
2026-06-30 10:10:14 -07:00
parent 508eecd0bd
commit 09167e44c7
9 changed files with 108 additions and 32 deletions
+10 -3
View File
@@ -1,6 +1,7 @@
from pathlib import Path
from serato_doctor.models import TrackReference
from serato_doctor.models.crate import Crate
from serato_doctor.models.reference import TrackReference
def read_crate_text(crate_path: Path) -> str:
@@ -20,7 +21,7 @@ def clean_path(raw: str) -> str:
return raw.strip()
def parse_crate(crate_path: Path) -> list[TrackReference]:
def load_crate(crate_path: Path) -> Crate:
text = read_crate_text(crate_path)
refs = []
@@ -48,7 +49,13 @@ def parse_crate(crate_path: Path) -> list[TrackReference]:
)
)
return refs
return Crate(path=crate_path, references=tuple(refs))
def parse_crate(crate_path: Path) -> list[TrackReference]:
"""Parse references from one crate, preserving the prototype API."""
return list(load_crate(crate_path).references)
def parse_crates(root: Path) -> list[TrackReference]: