Introduce core library model
This commit is contained in:
@@ -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]:
|
||||
|
||||
Reference in New Issue
Block a user