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:
1 parent
9bc9af87c7
commit
170ae6eed0
9 files changed
+67
-25
No files matched your search
+14
-8
@@ -25,14 +25,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$date = trim((string)($_POST['date'] ?? ''));
|
||||
$time = substr(trim((string)($_POST['time'] ?? '')), 0, 5);
|
||||
$scheduledAt = $date === '' && $time === '' ? null : stationTimeToUtc("$date $time");
|
||||
$episodeTitle = trim((string)($_POST['episode_title'] ?? ''));
|
||||
$label = $show['name'] . ($episodeTitle !== '' ? " ({$episodeTitle})" : '');
|
||||
if (!$show) {
|
||||
flash('Please choose a show.', 'error');
|
||||
} elseif (($date !== '' || $time !== '') && $scheduledAt === null) {
|
||||
flash('Please enter both a valid date and time, or leave both blank.', 'error');
|
||||
} elseif (setBroadcastShow($db, (int)$show['id'], $scheduledAt) === 'live') {
|
||||
flash("The live broadcast is now {$show['name']}.");
|
||||
} elseif (setBroadcastShow($db, (int)$show['id'], $scheduledAt, $episodeTitle) === 'live') {
|
||||
flash("The live broadcast is now {$label}.");
|
||||
} else {
|
||||
flash("{$show['name']} is queued" . ($scheduledAt ? ' for ' . describeScheduledAt($scheduledAt) : '')
|
||||
flash("{$label} is queued" . ($scheduledAt ? ' for ' . describeScheduledAt($scheduledAt) : '')
|
||||
. '. It will go live as soon as the stream starts.');
|
||||
}
|
||||
} elseif ($action === 'clear_queue') {
|
||||
@@ -54,9 +56,9 @@ adminHeader('Dashboard', $admin);
|
||||
<h3>Broadcast status</h3>
|
||||
<p>
|
||||
<?php if ($live): ?>
|
||||
<strong>Live now</strong><?= $current ? ': ' . e($current['name']) : ' (no show set)' ?>, since <?= e($live['started_at']) ?> UTC.
|
||||
<strong>Live now</strong><?= $current ? ': ' . e($current['name']) . ($current['episode_title'] ? ' — “' . e($current['episode_title']) . '”' : '') : ' (no show set)' ?>, since <?= e($live['started_at']) ?> UTC.
|
||||
<?php elseif ($current): ?>
|
||||
Offline. <strong><?= e($current['name']) ?></strong> is queued for the next broadcast<?= $current['scheduled_at'] ? ', scheduled for ' . e(describeScheduledAt($current['scheduled_at'])) : '' ?>.
|
||||
Offline. <strong><?= e($current['name']) ?></strong><?= $current['episode_title'] ? ' — “' . e($current['episode_title']) . '”' : '' ?> is queued for the next broadcast<?= $current['scheduled_at'] ? ', scheduled for ' . e(describeScheduledAt($current['scheduled_at'])) : '' ?>.
|
||||
<?php else: ?>
|
||||
Offline. No show is queued.
|
||||
<?php endif; ?>
|
||||
@@ -64,13 +66,13 @@ adminHeader('Dashboard', $admin);
|
||||
|
||||
<h3><?= $live ? 'Change the live show' : 'Queue the next show' ?></h3>
|
||||
<p><?= $live
|
||||
? 'Switch which show the live page and recently played list belong to.'
|
||||
: 'Choose the show before you start streaming. The broadcast goes live on the site automatically when the stream comes online. The show, and its start time if you enter one, appear on the main page until then.' ?></p>
|
||||
? 'Switch which show, and episode title, the live page and recently played list belong to.'
|
||||
: 'Choose the show before you start streaming. The broadcast goes live on the site automatically when the stream comes online. The show, and its episode title and start time if you enter them, appear on the main page until then.' ?></p>
|
||||
<form method="post" action="index.php">
|
||||
<?= csrfField() ?>
|
||||
<input type="hidden" name="action" value="set_show" />
|
||||
<div class="row gtr-uniform gtr-50">
|
||||
<div class="<?= $live ? 'col-8' : 'col-12' ?> col-12-small">
|
||||
<div class="col-12">
|
||||
<select name="show_id" aria-label="Show" required>
|
||||
<option value="">Choose a show…</option>
|
||||
<?php foreach ($shows as $show): ?>
|
||||
@@ -78,6 +80,10 @@ adminHeader('Dashboard', $admin);
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="<?= $live ? 'col-8' : 'col-12' ?> col-12-small">
|
||||
<label for="episode_title">Episode title (optional)</label>
|
||||
<input type="text" name="episode_title" id="episode_title" maxlength="255" placeholder="e.g. Ethereal and Enya" value="<?= $current && $current['episode_title'] ? e($current['episode_title']) : '' ?>" />
|
||||
</div>
|
||||
<?php if (!$live): ?>
|
||||
<div class="col-6 col-12-xsmall">
|
||||
<label for="date">Date (optional)</label>
|
||||
|
||||
Reference in new issue
Block a user