From f659b09a0b322c7774718d41c48a5b12f407cd68 Mon Sep 17 00:00:00 2001 From: Daniel Messer Date: Fri, 30 Oct 2026 09:30:20 -0500 Subject: [PATCH] Show the queued show and its start time in the index.php sidebar - Shows get a description and an icon upload; broadcasts get a scheduled_at start time. schema.sql adds the columns to existing databases and seeds the descriptions from the old hand-written sidebar. - The dashboard and cli/set_show.php take an optional date and Eastern start time when queuing; index.php shows it with the UTC conversion. - liveBroadcast() and currentShow() ignore broadcasts unseen for longer than the grace period, so a stopped poller can't leave a show stuck as live. Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 26 ++++---- SETUP.md | 11 ++-- admin/index.php | 39 +++++++++-- admin/show_edit.php | 133 ++++++++++++++++++++++++++------------ cli/set_show.php | 22 +++++-- includes/admin_layout.php | 11 ++++ includes/broadcasts.php | 30 +++++++-- index.php | 62 +++++++++++++++++- sql/schema.sql | 40 +++++++++++- 9 files changed, 297 insertions(+), 77 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index e6e3881..50b692e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -20,15 +20,15 @@ The one approved exception is [cli/poll_icecast.php](cli/poll_icecast.php), a cr ## Key Files Public pages: -- [index.php](index.php) — Main page. Contains the audio player, now-playing widget, upcoming schedule section, and about section. Show information is updated here manually before each broadcast. +- [index.php](index.php) — Main page. The sidebar shows the queued (or live) show from the database: icon, name, scheduled start time in Eastern and UTC, and description. The main column has the about section. - [live.php](live.php) — Page to send listeners to while streaming. Player on the left, recently played list on the right; the sidebar background and the heading change with the current show. - [now_playing.php](now_playing.php) — Returns the currently playing track as HTML. Called by `index.php` and `live.php` every 15 seconds. - [recently_played.php](recently_played.php) — Returns the current broadcast's track history as table rows for `live.php`. Admin backend ([admin/](admin/)): - [admin/login.php](admin/login.php), [admin/logout.php](admin/logout.php) — Username/password login. -- [admin/index.php](admin/index.php) — Dashboard: broadcast status, queue the next show, switch the live show, clear the queue. -- [admin/shows.php](admin/shows.php), [admin/show_edit.php](admin/show_edit.php) — List, add, edit and delete shows, including background image uploads. +- [admin/index.php](admin/index.php) — Dashboard: broadcast status, queue the next show (with an optional date and Eastern start time), switch the live show, clear the queue. +- [admin/shows.php](admin/shows.php), [admin/show_edit.php](admin/show_edit.php) — List, add, edit and delete shows, including the description and icon and background image uploads. Shared includes: - [includes/db.php](includes/db.php) — `getDB()` returns a shared PDO connection (session time zone UTC). @@ -39,7 +39,7 @@ Shared includes: Command-line tools (run over SSH from the site root): - [cli/poll_icecast.php](cli/poll_icecast.php) — Cron-run poller that records broadcasts and tracks. -- [cli/set_show.php](cli/set_show.php) — Lists shows, or queues/sets the show by slug. Same behaviour as the dashboard control. +- [cli/set_show.php](cli/set_show.php) — Lists shows, or queues/sets the show by slug, optionally with a start time (`php cli/set_show.php 2026-10-30 19:30`). Same behaviour as the dashboard control. - [cli/create_admin.php](cli/create_admin.php) — Creates an admin account or resets its password. Other: @@ -59,13 +59,13 @@ Other: MariaDB on localhost. Credentials live in `config/db_credentials.php`, which is gitignored and uploaded to the server separately. Tables (see [sql/schema.sql](sql/schema.sql)): -- `shows` — the shows, with a unique `slug` and an optional `background_image` (filename in `images/backgrounds/`). -- `broadcasts` — one row per streaming session: pending (`started_at` NULL, queued from the dashboard or `cli/set_show.php`), live (`ended_at` NULL), or ended. +- `shows` — the shows, with a unique `slug`, a plain-text `description` (blank lines separate paragraphs) and optional `icon_image` and `background_image` (filenames in `images/backgrounds/`). +- `broadcasts` — one row per streaming session: pending (`started_at` NULL, queued from the dashboard or `cli/set_show.php`), live (`ended_at` NULL), or ended. `scheduled_at` is the advertised start time shown on `index.php`; the broadcast still starts whenever the stream comes online. - `played_tracks` — tracks per broadcast. Cleared ten minutes after the broadcast ends; no long-term history is kept. - `admins` — admin accounts (username + password hash). - `login_attempts` — failed logins by IP, used for throttling. -All DATETIME values are UTC. `recently_played.php` outputs `