- New CameraEngine using OpenCV VideoCapture for webcam capture - HAS_OWN_DISPLAYS class attribute on CaptureEngine base to distinguish engines with their own device lists from desktop monitor engines - Display picker renders device list for cameras/scrcpy, spatial layout for desktop monitors - Engine-aware display label formatting (camera name vs monitor index) - Stream modal properly loads engine-specific displays on template change, edit, and clone - Camera backend config rendered as dropdown (auto/dshow/msmf/v4l2) - Remove offline label from device cards (healthcheck indicator suffices) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
77 lines
3.2 KiB
Python
77 lines
3.2 KiB
Python
"""Capture template and engine schemas."""
|
|
|
|
from datetime import datetime
|
|
from typing import Dict, List, Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class TemplateCreate(BaseModel):
|
|
"""Request to create a capture template."""
|
|
|
|
name: str = Field(description="Template name", min_length=1, max_length=100)
|
|
engine_type: str = Field(description="Engine type (e.g., 'mss', 'dxcam', 'wgc')", min_length=1)
|
|
engine_config: Dict = Field(default_factory=dict, description="Engine-specific configuration")
|
|
description: Optional[str] = Field(None, description="Template description", max_length=500)
|
|
|
|
|
|
class TemplateUpdate(BaseModel):
|
|
"""Request to update a template."""
|
|
|
|
name: Optional[str] = Field(None, description="Template name", min_length=1, max_length=100)
|
|
engine_type: Optional[str] = Field(None, description="Capture engine type (mss, dxcam, wgc)")
|
|
engine_config: Optional[Dict] = Field(None, description="Engine-specific configuration")
|
|
description: Optional[str] = Field(None, description="Template description", max_length=500)
|
|
|
|
|
|
class TemplateResponse(BaseModel):
|
|
"""Template information response."""
|
|
|
|
id: str = Field(description="Template ID")
|
|
name: str = Field(description="Template name")
|
|
engine_type: str = Field(description="Engine type identifier")
|
|
engine_config: Dict = Field(description="Engine-specific configuration")
|
|
created_at: datetime = Field(description="Creation timestamp")
|
|
updated_at: datetime = Field(description="Last update timestamp")
|
|
description: Optional[str] = Field(None, description="Template description")
|
|
|
|
|
|
class TemplateListResponse(BaseModel):
|
|
"""List of templates response."""
|
|
|
|
templates: List[TemplateResponse] = Field(description="List of templates")
|
|
count: int = Field(description="Number of templates")
|
|
|
|
|
|
class EngineInfo(BaseModel):
|
|
"""Capture engine information."""
|
|
|
|
type: str = Field(description="Engine type identifier (e.g., 'mss', 'dxcam')")
|
|
name: str = Field(description="Human-readable engine name")
|
|
default_config: Dict = Field(description="Default configuration for this engine")
|
|
available: bool = Field(description="Whether engine is available on this system")
|
|
has_own_displays: bool = Field(default=False, description="Engine has its own device list (not desktop monitors)")
|
|
|
|
|
|
class EngineListResponse(BaseModel):
|
|
"""List of available engines response."""
|
|
|
|
engines: List[EngineInfo] = Field(description="Available capture engines")
|
|
count: int = Field(description="Number of engines")
|
|
|
|
|
|
class TemplateAssignment(BaseModel):
|
|
"""Request to assign template to device."""
|
|
|
|
template_id: str = Field(description="Template ID to assign")
|
|
|
|
|
|
class TemplateTestRequest(BaseModel):
|
|
"""Request to test a capture template."""
|
|
|
|
engine_type: str = Field(description="Capture engine type to test")
|
|
engine_config: Dict = Field(default={}, description="Engine configuration")
|
|
display_index: int = Field(description="Display index to capture")
|
|
border_width: int = Field(default=10, ge=1, le=100, description="Border width in pixels")
|
|
capture_duration: float = Field(default=5.0, ge=1.0, le=30.0, description="Duration to capture in seconds")
|