feat(schema): implement pydantic schemas and tempo conversion logic
This commit is contained in:
43
src/songsplit/schema/meta.py
Normal file
43
src/songsplit/schema/meta.py
Normal file
@ -0,0 +1,43 @@
|
||||
"""Schema for meta.json."""
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from songsplit.schema.base import SongPackageBase
|
||||
|
||||
|
||||
class SourceFileInfo(BaseModel):
|
||||
"""Information about the original source audio/video file."""
|
||||
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
|
||||
path: str
|
||||
sha256: str
|
||||
size_bytes: int
|
||||
|
||||
|
||||
class ModelInfo(BaseModel):
|
||||
"""Information about an AI model used during processing."""
|
||||
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
|
||||
stage: str
|
||||
name: str
|
||||
version: str
|
||||
|
||||
|
||||
class MetaDocument(SongPackageBase):
|
||||
"""Song-Paket metadata document (meta.json)."""
|
||||
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
|
||||
title: str | None = None
|
||||
artist: str | None = None
|
||||
language: str | None = None
|
||||
duration_sec: float = Field(ge=0.0)
|
||||
source_file: SourceFileInfo
|
||||
key: str | None = None
|
||||
capo: int | None = None
|
||||
models_used: list[ModelInfo] = Field(default_factory=list)
|
||||
created_at: str
|
||||
stages_done: list[str] = Field(default_factory=list)
|
||||
stages_failed: dict[str, str] = Field(default_factory=dict)
|
||||
Reference in New Issue
Block a user