- Slides library (Alembic 0044, /api/signage/library): slides kept with a name and a
description, added to playlists as copies ("Add a slide" → Your slides, "Keep in Slides"),
or shown alone as a screen's default (device config `slide`, played as "slide:<id>",
also as a schedule's fallback). Signage → Slides: gallery + a two-pane editor.
- Widgets moved and sized by hand on the preview (WidgetCanvas: handles, snapping, arrow
keys): position/size "custom" with a box the TV draws the same; alignment per widget.
- Blank slides (background + widgets); menu boards narrower and placed left/centre/right.
- Slide editor reworked: name | show, transition effect | seconds; sections; text look on
one row with ready colours; one card per widget, settings on one row.
- Questions inside the page (@xenia/ui ConfirmDialog/useConfirm), Switch boxed, Segmented
fill; the timeline's drop line; schedule lines run on weekdays or smart days, not both;
the playlist editor stays within 1080p with a long timeline.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
107 lines
5.9 KiB
Python
107 lines
5.9 KiB
Python
"""Digital signage (plan steps 5.4a-5.4d): playlists of slides for TVs.
|
|
|
|
A playlist is made for one orientation (the people who build it see the screen's shape) and
|
|
holds slides in order. A slide is a menu board, a full-screen picture, a full-screen video or
|
|
a text, with its time on screen, its transition and when it may show (days, hours, dates).
|
|
What the slide shows is `content`, typed per kind in routers/signage.py (pictures and videos
|
|
as media library ids, which the library protects while used).
|
|
|
|
A paired signage screen plays its default playlist (device config `playlist`) in its own
|
|
orientation and rotation (modules/signage/manifest.py), unless a schedule line for it matches
|
|
(SignageScheduleItem, 2026-11-21).
|
|
"""
|
|
from sqlalchemy import JSON, Boolean, Column, ForeignKey, Integer, String
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from core.timeutil import UTCDateTime, utcnow
|
|
from database import Base
|
|
|
|
|
|
class SignagePlaylist(Base):
|
|
__tablename__ = "signage_playlists"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
name = Column(String, nullable=False)
|
|
orientation = Column(String, nullable=False, default="landscape") # landscape | portrait
|
|
transition = Column(String, nullable=False, default="fade") # the slides' default
|
|
created_at = Column(UTCDateTime, default=utcnow, nullable=False)
|
|
updated_at = Column(UTCDateTime, default=utcnow, onupdate=utcnow, nullable=False)
|
|
|
|
slides = relationship("SignageSlide", back_populates="playlist", cascade="all, delete-orphan",
|
|
order_by="SignageSlide.position")
|
|
|
|
|
|
class SignageSlide(Base):
|
|
__tablename__ = "signage_slides"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
playlist_id = Column(Integer, ForeignKey("signage_playlists.id", ondelete="CASCADE"), nullable=False, index=True)
|
|
position = Column(Integer, nullable=False, default=0)
|
|
kind = Column(String, nullable=False) # menu | image | video | text
|
|
name = Column(String, nullable=True) # the timeline's label (optional)
|
|
duration_s = Column(Integer, nullable=False, default=10)
|
|
transition = Column(String, nullable=True) # None: the playlist's
|
|
video_to_end = Column(Boolean, nullable=False, default=False)
|
|
enabled = Column(Boolean, nullable=False, default=True)
|
|
# When it may show (venue time); empty = always
|
|
days = Column(JSON, nullable=True) # [0..6], Monday = 0
|
|
time_from = Column(String, nullable=True) # "HH:MM"
|
|
time_to = Column(String, nullable=True) # "HH:MM" (may pass midnight)
|
|
date_from = Column(String, nullable=True) # "YYYY-MM-DD"
|
|
date_to = Column(String, nullable=True)
|
|
content = Column(JSON, nullable=False, default=dict)
|
|
|
|
playlist = relationship("SignagePlaylist", back_populates="slides")
|
|
|
|
|
|
class SignageScheduleItem(Base):
|
|
"""A schedule line (owner 2026-11-21, was named schedules of 5.4d): a playlist on some screens
|
|
(none picked = every screen), on some days / hours / dates / smart days (core/calendar_days.py),
|
|
optionally only while a scene is on, with a priority. At a moment, a screen plays the line
|
|
that matches with the highest priority (then the most specific, then the later one); none →
|
|
its own default playlist (Screens). services/signage_schedule.py."""
|
|
__tablename__ = "signage_schedule_items"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
name = Column(String, nullable=True)
|
|
playlist_id = Column(Integer, ForeignKey("signage_playlists.id", ondelete="CASCADE"), nullable=False, index=True)
|
|
screen_ids = Column(JSON, nullable=False, default=list) # [] = every screen
|
|
priority = Column(Integer, nullable=False, default=0)
|
|
enabled = Column(Boolean, nullable=False, default=True)
|
|
days = Column(JSON, nullable=False, default=list) # [0..6], Monday = 0; [] = every day
|
|
month_days = Column(JSON, nullable=False, default=list) # smart days: first, last, first_week, last_week, holiday, not_holiday
|
|
time_from = Column(String, nullable=True)
|
|
time_to = Column(String, nullable=True)
|
|
date_from = Column(String, nullable=True)
|
|
date_to = Column(String, nullable=True)
|
|
scene_id = Column(Integer, ForeignKey("scenes.id", ondelete="SET NULL"), nullable=True, index=True)
|
|
position = Column(Integer, nullable=False, default=0)
|
|
created_at = Column(UTCDateTime, default=utcnow, nullable=False)
|
|
updated_at = Column(UTCDateTime, default=utcnow, onupdate=utcnow, nullable=False)
|
|
|
|
|
|
class SignageSavedSlide(Base):
|
|
"""A slide kept in the Slides library (owner 2026-11-21): built once, with a name and a short
|
|
description, then added to playlists (a copy goes in) or shown alone on a screen that has it
|
|
as its default (device config `slide`). The same fields as a playlist's slide, plus the shape
|
|
it is built for (its preview and the picture-fit warnings)."""
|
|
__tablename__ = "signage_saved_slides"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
name = Column(String, nullable=False)
|
|
description = Column(String, nullable=True)
|
|
orientation = Column(String, nullable=False, default="landscape") # landscape | portrait
|
|
kind = Column(String, nullable=False) # menu | image | video | text | blank
|
|
duration_s = Column(Integer, nullable=False, default=10)
|
|
transition = Column(String, nullable=True)
|
|
video_to_end = Column(Boolean, nullable=False, default=False)
|
|
enabled = Column(Boolean, nullable=False, default=True)
|
|
days = Column(JSON, nullable=True)
|
|
time_from = Column(String, nullable=True)
|
|
time_to = Column(String, nullable=True)
|
|
date_from = Column(String, nullable=True)
|
|
date_to = Column(String, nullable=True)
|
|
content = Column(JSON, nullable=False, default=dict)
|
|
created_at = Column(UTCDateTime, default=utcnow, nullable=False)
|
|
updated_at = Column(UTCDateTime, default=utcnow, onupdate=utcnow, nullable=False)
|