Make count-dependent streams non-sharable, each target gets own instance

Static, gradient, color cycle, and effect streams depend on LED count
and were being reconfigured per-consumer when shared. Now only picture
streams (expensive capture) are shared; count-dependent sources get
per-consumer instances keyed by css_id:target_id.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-23 02:31:08 +03:00
parent e32bfab888
commit e5a6eafd09
3 changed files with 114 additions and 105 deletions

View File

@@ -33,6 +33,15 @@ class ColorStripSource:
updated_at: datetime
description: Optional[str] = None
@property
def sharable(self) -> bool:
"""Whether multiple consumers can share a single stream instance.
Count-dependent sources (static, gradient, cycle, effect) return False
because each consumer may configure a different LED count.
"""
return False
def to_dict(self) -> dict:
"""Convert source to dictionary. Subclasses extend this."""
return {
@@ -174,6 +183,11 @@ class PictureColorStripSource(ColorStripSource):
calibration (LED positions), color correction, smoothing, FPS target.
"""
@property
def sharable(self) -> bool:
"""Picture streams are expensive (screen capture) and safe to share."""
return True
picture_source_id: str = ""
fps: int = 30
brightness: float = 1.0 # color correction multiplier (0.02.0; 1.0 = unchanged)