feat: Add fast startup fetch and background caching
- Add for quick startup using first N feeds - Add background thread for full fetch and caching - Update to use fast fetch - Update docs and skills
This commit is contained in:
@@ -62,6 +62,16 @@ class CameraClockStage(Stage):
|
||||
if data is None:
|
||||
return data
|
||||
|
||||
# Update camera speed from params if explicitly set (for dynamic modulation)
|
||||
# Only update if camera_speed in params differs from the default (1.0)
|
||||
# This preserves camera speed set during construction
|
||||
if (
|
||||
ctx.params
|
||||
and hasattr(ctx.params, "camera_speed")
|
||||
and ctx.params.camera_speed != 1.0
|
||||
):
|
||||
self._camera.set_speed(ctx.params.camera_speed)
|
||||
|
||||
current_time = time.perf_counter()
|
||||
dt = 0.0
|
||||
if self._last_frame_time is not None:
|
||||
|
||||
@@ -32,7 +32,7 @@ class PipelineParams:
|
||||
|
||||
# Camera config
|
||||
camera_mode: str = "vertical"
|
||||
camera_speed: float = 1.0
|
||||
camera_speed: float = 1.0 # Default speed
|
||||
camera_x: int = 0 # For horizontal scrolling
|
||||
|
||||
# Effect config
|
||||
|
||||
@@ -11,11 +11,14 @@ Loading order:
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from engine.display import BorderMode
|
||||
from engine.pipeline.params import PipelineParams
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from engine.pipeline.controller import PipelineConfig
|
||||
|
||||
|
||||
def _load_toml_presets() -> dict[str, Any]:
|
||||
"""Load presets from TOML file."""
|
||||
@@ -55,9 +58,10 @@ class PipelinePreset:
|
||||
viewport_width: int = 80 # Viewport width in columns
|
||||
viewport_height: int = 24 # Viewport height in rows
|
||||
source_items: list[dict[str, Any]] | None = None # For ListDataSource
|
||||
enable_metrics: bool = True # Enable performance metrics collection
|
||||
|
||||
def to_params(self) -> PipelineParams:
|
||||
"""Convert to PipelineParams."""
|
||||
"""Convert to PipelineParams (runtime configuration)."""
|
||||
from engine.display import BorderMode
|
||||
|
||||
params = PipelineParams()
|
||||
@@ -72,10 +76,27 @@ class PipelinePreset:
|
||||
)
|
||||
params.camera_mode = self.camera
|
||||
params.effect_order = self.effects.copy()
|
||||
# Note: camera_speed, viewport_width/height are not stored in PipelineParams
|
||||
# They are used directly from the preset object in pipeline_runner.py
|
||||
params.camera_speed = self.camera_speed
|
||||
# Note: viewport_width/height are read from PipelinePreset directly
|
||||
# in pipeline_runner.py, not from PipelineParams
|
||||
return params
|
||||
|
||||
def to_config(self) -> "PipelineConfig":
|
||||
"""Convert to PipelineConfig (static pipeline construction config).
|
||||
|
||||
PipelineConfig is used once at pipeline initialization and contains
|
||||
the core settings that don't change during execution.
|
||||
"""
|
||||
from engine.pipeline.controller import PipelineConfig
|
||||
|
||||
return PipelineConfig(
|
||||
source=self.source,
|
||||
display=self.display,
|
||||
camera=self.camera,
|
||||
effects=self.effects.copy(),
|
||||
enable_metrics=self.enable_metrics,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_yaml(cls, name: str, data: dict[str, Any]) -> "PipelinePreset":
|
||||
"""Create a PipelinePreset from YAML data."""
|
||||
@@ -91,6 +112,7 @@ class PipelinePreset:
|
||||
viewport_width=data.get("viewport_width", 80),
|
||||
viewport_height=data.get("viewport_height", 24),
|
||||
source_items=data.get("source_items"),
|
||||
enable_metrics=data.get("enable_metrics", True),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user