37 lines
979 B
Python
37 lines
979 B
Python
from pydantic import BaseModel, Field
|
|
|
|
|
|
class Camera(BaseModel):
|
|
name: str = Field(min_length=1, max_length=64, pattern=r"^[a-zA-Z0-9_\-\/]+$")
|
|
rtsp_url: str = Field(min_length=1, max_length=2048)
|
|
|
|
|
|
class Schedule(BaseModel):
|
|
enabled: bool = True
|
|
weekdays_from: str = Field(default="18:00", pattern=r"^\d{2}:\d{2}$")
|
|
weekdays_to: str = Field(default="08:00", pattern=r"^\d{2}:\d{2}$")
|
|
weekend_all_day: bool = True
|
|
|
|
|
|
class AppConfig(BaseModel):
|
|
mediamtx_api_url: str = "http://127.0.0.1:9997"
|
|
mediamtx_webrtc_url: str = "http://127.0.0.1:8889"
|
|
recordings_dir: str = "/recordings"
|
|
cameras: list[Camera] = Field(default_factory=list)
|
|
schedule: Schedule = Field(default_factory=Schedule)
|
|
|
|
|
|
class RecordingToggle(BaseModel):
|
|
enabled: bool
|
|
|
|
|
|
class SchedulerEnabled(BaseModel):
|
|
enabled: bool
|
|
|
|
|
|
class ScheduleUpdate(BaseModel):
|
|
weekdays_from: str = Field(pattern=r"^\d{2}:\d{2}$")
|
|
weekdays_to: str = Field(pattern=r"^\d{2}:\d{2}$")
|
|
weekend_all_day: bool
|
|
|