feat(01-01): create package structure, Pydantic models, and device abstractions
- pyproject.toml with FastAPI, uvicorn, Pydantic v2, aiofiles, structlog deps - DeviceConfig Pydantic model with StripType, UUID, validation constraints - ShowModel with AudioRef, TrackModel, CueModel, AnalysisBlock, schema_version=1 - BaseDevice ABC with encode_frame, encode_animation_cmd, bytes_per_pixel - SK6812Device (4 bytes/pixel) and WS2801Device (3 bytes/pixel) implementations
This commit is contained in:
17
lightsync/models/device.py
Normal file
17
lightsync/models/device.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from uuid import UUID, uuid4
|
||||
from typing import Literal
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
StripType = Literal["sk6812", "ws2801", "generic"]
|
||||
|
||||
|
||||
class DeviceConfig(BaseModel):
|
||||
id: UUID = Field(default_factory=uuid4)
|
||||
name: str
|
||||
strip_type: StripType
|
||||
led_count: int = Field(gt=0, le=1000)
|
||||
ip: str
|
||||
port: int = Field(ge=1, le=65535)
|
||||
enabled: bool = True
|
||||
|
||||
model_config = {"populate_by_name": True}
|
||||
Reference in New Issue
Block a user