fix(scenes): coerce BindableFloat fps to int when snapshotting
OutputTarget.fps is a BindableFloat but TargetSnapshot.fps is a plain int — capture_current_snapshot was stuffing the BindableFloat directly into the snapshot, causing json.dumps to fail on recapture (500) and polluting the in-memory cache so subsequent list calls also 500'd with pydantic validation errors.
This commit is contained in:
@@ -6,6 +6,7 @@ These functions are used by both the scene-presets API route and the automation
|
||||
from typing import List, Optional, Set, Tuple
|
||||
|
||||
from ledgrab.core.processing.processor_manager import ProcessorManager
|
||||
from ledgrab.storage.bindable import bfloat
|
||||
from ledgrab.storage.output_target_store import OutputTargetStore
|
||||
from ledgrab.storage.scene_preset import (
|
||||
ScenePreset,
|
||||
@@ -38,7 +39,7 @@ def capture_current_snapshot(
|
||||
running=running,
|
||||
color_strip_source_id=getattr(t, "color_strip_source_id", ""),
|
||||
brightness_value_source_id=getattr(t, "brightness_value_source_id", ""),
|
||||
fps=getattr(t, "fps", 30),
|
||||
fps=int(bfloat(getattr(t, "fps", 30), default=30.0)),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -82,7 +83,7 @@ async def apply_scene_state(
|
||||
changed["color_strip_source_id"] = ts.color_strip_source_id
|
||||
if getattr(target, "brightness_value_source_id", None) != ts.brightness_value_source_id:
|
||||
changed["brightness_value_source_id"] = ts.brightness_value_source_id
|
||||
if getattr(target, "fps", None) != ts.fps:
|
||||
if int(bfloat(getattr(target, "fps", 30), default=30.0)) != ts.fps:
|
||||
changed["fps"] = ts.fps
|
||||
if changed:
|
||||
target.update_fields(**changed)
|
||||
|
||||
Reference in New Issue
Block a user