Navidrome now-playing, clock, and weather for a Waveshare epd4in0e panel, with a local web UI and install/uninstall scripts for the Pi.
36 lines
1.0 KiB
Python
36 lines
1.0 KiB
Python
"""Development stand-in for the real panel: saves each frame as a PNG instead
|
|
of writing to hardware, so the scheduler/rendering logic can be exercised off
|
|
the Pi.
|
|
"""
|
|
|
|
import logging
|
|
from pathlib import Path
|
|
|
|
from PIL import Image
|
|
|
|
from display import Display
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class MockDisplay(Display):
|
|
def __init__(self, resolution: tuple[int, int], out_dir: str = "./mock_output"):
|
|
self.resolution = resolution
|
|
self.out_dir = Path(out_dir)
|
|
self.out_dir.mkdir(parents=True, exist_ok=True)
|
|
self._frame_count = 0
|
|
|
|
def init(self) -> None:
|
|
logger.info("MockDisplay initialized (resolution=%s)", self.resolution)
|
|
|
|
def show(self, image: Image.Image) -> None:
|
|
self._frame_count += 1
|
|
path = self.out_dir / "current.png"
|
|
image.save(path)
|
|
history_path = self.out_dir / f"frame_{self._frame_count:04d}.png"
|
|
image.save(history_path)
|
|
logger.info("MockDisplay: wrote frame to %s", path)
|
|
|
|
def sleep(self) -> None:
|
|
logger.info("MockDisplay: sleep")
|