Add Key Colors target type for extracting colors from screen regions
Introduce a new "key_colors" target type alongside WLED targets, enabling real-time color extraction from configurable screen rectangles with average/median/dominant modes, temporal smoothing, and WebSocket streaming. - Split WledPictureTarget into its own module, add KeyColorsPictureTarget - Add KC target lifecycle to ProcessorManager (register, start/stop, processing loop) - Extend API routes and schemas for KC targets (CRUD, settings, state, metrics, colors) - Add WebSocket endpoint for real-time color updates with auth - Add KC sub-tab in Targets UI with editor modal and live color swatches - Add EN and RU translations for all key colors strings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,8 @@ from wled_controller.storage.template_store import TemplateStore
|
||||
from wled_controller.storage.postprocessing_template_store import PostprocessingTemplateStore
|
||||
from wled_controller.storage.picture_source_store import PictureSourceStore
|
||||
from wled_controller.storage.picture_target_store import PictureTargetStore
|
||||
from wled_controller.storage.picture_target import WledPictureTarget
|
||||
from wled_controller.storage.wled_picture_target import WledPictureTarget
|
||||
from wled_controller.storage.key_colors_picture_target import KeyColorsPictureTarget
|
||||
from wled_controller.utils import setup_logging, get_logger
|
||||
|
||||
# Initialize logging
|
||||
@@ -172,6 +173,17 @@ async def lifespan(app: FastAPI):
|
||||
logger.info(f"Registered target: {target.name} ({target.id})")
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to register target {target.id}: {e}")
|
||||
elif isinstance(target, KeyColorsPictureTarget):
|
||||
try:
|
||||
processor_manager.add_kc_target(
|
||||
target_id=target.id,
|
||||
picture_source_id=target.picture_source_id,
|
||||
settings=target.settings,
|
||||
)
|
||||
registered_targets += 1
|
||||
logger.info(f"Registered KC target: {target.name} ({target.id})")
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to register KC target {target.id}: {e}")
|
||||
|
||||
logger.info(f"Registered {registered_targets} picture target(s)")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user