Add capture template system with in-memory defaults and split device settings UI
Some checks failed
Validate / validate (push) Failing after 8s
Some checks failed
Validate / validate (push) Failing after 8s
- Generate default templates (MSS, DXcam, WGC) in memory from EngineRegistry at startup - Only persist user-created templates to JSON, skip defaults on load/save - Add capture_template_id to Device model and DeviceCreate schema - Remember last used template in localStorage, use it for new devices with fallback - Split Device Settings dialog into General Settings and Capture Settings - Add capture settings button (🎬) to device card - Separate default and custom templates with visual separator in Templates tab - Add capture engine integration to ProcessorManager - Add CLAUDE.md with git commit/push policy and server restart instructions - Add en/ru localization for all new UI elements Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -176,6 +176,7 @@ async def create_device(
|
||||
_auth: AuthRequired,
|
||||
store: DeviceStore = Depends(get_device_store),
|
||||
manager: ProcessorManager = Depends(get_processor_manager),
|
||||
template_store: TemplateStore = Depends(get_template_store),
|
||||
):
|
||||
"""Create and attach a new WLED device."""
|
||||
try:
|
||||
@@ -214,11 +215,29 @@ async def create_device(
|
||||
detail=f"Failed to connect to WLED device at {device_url}: {e}"
|
||||
)
|
||||
|
||||
# Resolve capture template: use requested ID if valid, else first available
|
||||
capture_template_id = None
|
||||
if device_data.capture_template_id:
|
||||
try:
|
||||
template_store.get_template(device_data.capture_template_id)
|
||||
capture_template_id = device_data.capture_template_id
|
||||
except ValueError:
|
||||
logger.warning(
|
||||
f"Requested template '{device_data.capture_template_id}' not found, using first available"
|
||||
)
|
||||
if not capture_template_id:
|
||||
all_templates = template_store.get_all_templates()
|
||||
if all_templates:
|
||||
capture_template_id = all_templates[0].id
|
||||
else:
|
||||
capture_template_id = "tpl_mss_default"
|
||||
|
||||
# Create device in storage (LED count auto-detected from WLED)
|
||||
device = store.create_device(
|
||||
name=device_data.name,
|
||||
url=device_data.url,
|
||||
led_count=wled_led_count,
|
||||
capture_template_id=capture_template_id,
|
||||
)
|
||||
|
||||
# Add to processor manager
|
||||
|
||||
Reference in New Issue
Block a user