forked from genewildish/Mainline
feat(pipeline): Integrate MessageOverlayStage into pipeline construction
- Import MessageOverlayStage in pipeline_runner.py - Add message overlay stage when preset.enable_message_overlay is True - Add overlay stage in both initial construction and preset change handler - Use config.NTFY_TOPIC and config.MESSAGE_DISPLAY_SECS for configuration
This commit is contained in:
@@ -12,6 +12,7 @@ from engine.fetch import fetch_all, fetch_all_fast, fetch_poetry, load_cache, sa
|
|||||||
from engine.pipeline import Pipeline, PipelineConfig, PipelineContext, get_preset
|
from engine.pipeline import Pipeline, PipelineConfig, PipelineContext, get_preset
|
||||||
from engine.pipeline.adapters import (
|
from engine.pipeline.adapters import (
|
||||||
EffectPluginStage,
|
EffectPluginStage,
|
||||||
|
MessageOverlayStage,
|
||||||
SourceItemsToBufferStage,
|
SourceItemsToBufferStage,
|
||||||
create_stage_from_display,
|
create_stage_from_display,
|
||||||
create_stage_from_effect,
|
create_stage_from_effect,
|
||||||
@@ -311,6 +312,21 @@ def run_pipeline_mode(preset_name: str = "demo"):
|
|||||||
f"effect_{effect_name}", create_stage_from_effect(effect, effect_name)
|
f"effect_{effect_name}", create_stage_from_effect(effect, effect_name)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Add message overlay stage if enabled
|
||||||
|
if getattr(preset, "enable_message_overlay", False):
|
||||||
|
from engine.pipeline.adapters import MessageOverlayConfig
|
||||||
|
|
||||||
|
overlay_config = MessageOverlayConfig(
|
||||||
|
enabled=True,
|
||||||
|
display_secs=config.MESSAGE_DISPLAY_SECS
|
||||||
|
if hasattr(config, "MESSAGE_DISPLAY_SECS")
|
||||||
|
else 30,
|
||||||
|
topic_url=config.NTFY_TOPIC if hasattr(config, "NTFY_TOPIC") else None,
|
||||||
|
)
|
||||||
|
pipeline.add_stage(
|
||||||
|
"message_overlay", MessageOverlayStage(config=overlay_config)
|
||||||
|
)
|
||||||
|
|
||||||
pipeline.add_stage("display", create_stage_from_display(display, display_name))
|
pipeline.add_stage("display", create_stage_from_display(display, display_name))
|
||||||
|
|
||||||
pipeline.build()
|
pipeline.build()
|
||||||
@@ -625,6 +641,23 @@ def run_pipeline_mode(preset_name: str = "demo"):
|
|||||||
create_stage_from_effect(effect, effect_name),
|
create_stage_from_effect(effect, effect_name),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Add message overlay stage if enabled
|
||||||
|
if getattr(new_preset, "enable_message_overlay", False):
|
||||||
|
from engine.pipeline.adapters import MessageOverlayConfig
|
||||||
|
|
||||||
|
overlay_config = MessageOverlayConfig(
|
||||||
|
enabled=True,
|
||||||
|
display_secs=config.MESSAGE_DISPLAY_SECS
|
||||||
|
if hasattr(config, "MESSAGE_DISPLAY_SECS")
|
||||||
|
else 30,
|
||||||
|
topic_url=config.NTFY_TOPIC
|
||||||
|
if hasattr(config, "NTFY_TOPIC")
|
||||||
|
else None,
|
||||||
|
)
|
||||||
|
pipeline.add_stage(
|
||||||
|
"message_overlay", MessageOverlayStage(config=overlay_config)
|
||||||
|
)
|
||||||
|
|
||||||
# Add display (respect CLI override)
|
# Add display (respect CLI override)
|
||||||
display_name = new_preset.display
|
display_name = new_preset.display
|
||||||
if "--display" in sys.argv:
|
if "--display" in sys.argv:
|
||||||
|
|||||||
Reference in New Issue
Block a user