feat: departure board image and vendored Roboto fonts

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
rickzkmandClaude Sonnet 5.5 committed 2026-10-07 00:40:14 +02:00
1 parent e199600140
commit baaaeff917
10 files changed
+425 -6

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
"""Render sample boards from the frozen fixtures to docs/previews/board.png (no screen needed)."""
from datetime import datetime
import holidays
from PIL import Image
import board
from schedule import next_departures
from tests.helpers import FONT_DIR, ROOT, load_timetables
SAMPLES = [
(datetime(2026, 10, 6, 13, 28, 20), False), # afternoon
(datetime(2026, 10, 6, 23, 52, 30), True), # after the last bus, stale marker
(datetime(2026, 10, 6, 14, 47, 50), False), # next bus in 1 minute
]
def main() -> None:
fonts = board.load_fonts(FONT_DIR)
timetables = load_timetables()
state_holidays = holidays.CZ()
sheet = Image.new("RGB", (board.W * len(SAMPLES) + 20 * (len(SAMPLES) - 1), board.H), (40, 40, 40))
for i, (now, stale) in enumerate(SAMPLES):
upcoming = next_departures(timetables, now, board.ROWS + 1, state_holidays)
sheet.paste(board.render_board(upcoming, now, fonts, stale), (i * (board.W + 20), 0))
out = ROOT / "docs" / "previews" / "board.png"
sheet.save(out)
print(out)
if __name__ == "__main__":
main()