Add optional episode titles to queued and live broadcasts

Store an episode_title on each broadcast, settable from the dashboard
or with set_show.php --title=, and show it under the show name on
index.php and under the heading on live.php.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daniel MesserandClaude Opus 5.5 committed 2026-10-30 16:11:22 -05:00
1 parent 9bc9af87c7
commit 170ae6eed0
9 files changed
+67 -25

No files matched your search

+21 -7
View File
@@ -5,6 +5,8 @@
// (or assign it to the live one if already streaming)
// php cli/set_show.php <slug> 2026-10-30 19:30
// queue it with an advertised start time (Eastern) for the main page
// php cli/set_show.php <slug> 2026-10-30 19:30 --title="Ethereal and Enya"
// also give the episode a title (works with or without a start time)
if (PHP_SAPI !== 'cli') {
http_response_code(403);
@@ -15,10 +17,20 @@ require __DIR__ . '/../includes/db.php';
require __DIR__ . '/../includes/broadcasts.php';
$db = getDB();
$slug = $argv[1] ?? null;
// Pull out --title=... so the remaining arguments stay positional
$episodeTitle = null;
$args = [];
foreach (array_slice($argv, 1) as $arg) {
if (str_starts_with($arg, '--title=')) {
$episodeTitle = substr($arg, 8);
} else {
$args[] = $arg;
}
}
$slug = $args[0] ?? null;
$scheduledAt = null;
if (isset($argv[2])) {
$scheduledAt = stationTimeToUtc($argv[2] . ' ' . ($argv[3] ?? ''));
if (isset($args[1])) {
$scheduledAt = stationTimeToUtc($args[1] . ' ' . ($args[2] ?? ''));
if ($scheduledAt === null) {
fwrite(STDERR, "Start time must be a valid date and time like 2026-10-30 19:30 (" . STATION_TIMEZONE_LABEL . ").\n");
exit(1);
@@ -31,7 +43,8 @@ if ($slug === null) {
printf(" %-20s %s\n", $show['slug'], $show['name']);
}
$current = currentShow($db);
echo "\nCurrent: " . ($current ? $current['name'] : '(none)') . (liveBroadcast($db) ? ' [live]' : '');
echo "\nCurrent: " . ($current ? $current['name'] : '(none)')
. ($current && $current['episode_title'] ? " \"{$current['episode_title']}\"" : '') . (liveBroadcast($db) ? ' [live]' : '');
if ($current && $current['scheduled_at'] && !$current['started_at']) {
echo ', scheduled for ' . utcToStationTime($current['scheduled_at'])->format('Y-m-d H:i') . ' ' . STATION_TIMEZONE_LABEL . " ({$current['scheduled_at']} UTC)";
}
@@ -47,8 +60,9 @@ if (!$show) {
exit(1);
}
if (setBroadcastShow($db, (int)$show['id'], $scheduledAt) === 'live') {
echo "Live broadcast is now {$show['name']}." . ($scheduledAt ? ' (Start time ignored.)' : '') . "\n";
$label = $show['name'] . (trim((string)$episodeTitle) !== '' ? ' "' . trim($episodeTitle) . '"' : '');
if (setBroadcastShow($db, (int)$show['id'], $scheduledAt, $episodeTitle) === 'live') {
echo "Live broadcast is now {$label}." . ($scheduledAt ? ' (Start time ignored.)' : '') . "\n";
} else {
echo "{$show['name']} is queued for the next broadcast" . ($scheduledAt ? " at {$argv[2]} {$argv[3]} " . STATION_TIMEZONE_LABEL . " ({$scheduledAt} UTC)" : '') . ".\n";
echo "{$label} is queued for the next broadcast" . ($scheduledAt ? " at {$args[1]} {$args[2]} " . STATION_TIMEZONE_LABEL . " ({$scheduledAt} UTC)" : '') . ".\n";
}