From 4152de87f02b9ea3356918c2857a70df3021bd82 Mon Sep 17 00:00:00 2001 From: Ken Fallon Date: Fri, 30 Jan 2026 10:43:01 +0100 Subject: [PATCH] Clarified the error message --- hub/calendar-wip.php | 367 +++++++++++++++++++++++++++++++++++++++++++ hub/request.php | 2 +- 2 files changed, 368 insertions(+), 1 deletion(-) create mode 100644 hub/calendar-wip.php diff --git a/hub/calendar-wip.php b/hub/calendar-wip.php new file mode 100644 index 0000000..5d889ad --- /dev/null +++ b/hub/calendar-wip.php @@ -0,0 +1,367 @@ +\n"; + +// -------------------------------------------- +// Get latest published show + +$query = mysqli_query($connection, "SELECT max(date), max(id) from eps WHERE eps.date <= UTC_DATE()"); +$current_episode_array = mysqli_fetch_row($query); +$current_episode_date = $current_episode_array[0]; +$current_episode_number = $current_episode_array[1]; + +print "\n"; +print "\n"; + +// -------------------------------------------- +// Get highest scheduled or reserved show + +$query = mysqli_query($connection, "SELECT MAX(id) FROM eps as maxid;"); +$max_episode_array = mysqli_fetch_row($query); +$max_episode_number = $max_episode_array[0]; +print "\n"; + +// -------------------------------------------- +// Get the number of shows in the reserve queue. + +$query = mysqli_query($connection, "SELECT COUNT(*) as count_reserve_queue FROM reservations WHERE status = 'RESERVE_SHOW_SUBMITTED' AND ip = '127.0.0.1';"); +$response_array = mysqli_fetch_row($query); +$count_reserve_queue = $response_array[0]; +print "\n"; + +// -------------------------------------------- +// Get the number of shows in the reserve queue yet to be processed. + +$query = mysqli_query($connection, "SELECT COUNT(*) as count_reserve_queue_unprocessed FROM reservations WHERE status = 'RESERVE_SHOW_SUBMITTED' AND ip != '127.0.0.1';"); +$response_array = mysqli_fetch_row($query); +$count_reserve_queue_unprocessed = $response_array[0]; +print "\n"; + +// -------------------------------------------- +// Populate array with future shows and reservations +$show_array = array (); + +// REQUEST_UNVERIFIED → SHOW_SUBMITTED → METADATA_PROCESSED → SHOW_POSTED → MEDIA_TRANSCODED → UPLOADED_TO_IA → UPLOADED_TO_RSYNC_NET +$ep_retrieve = "SELECT hosts.host, eps.id, eps.title, eps.date FROM eps, hosts WHERE eps.valid=1 AND eps.hostid = hosts.hostid AND eps.date >= '$current_episode_date' ORDER BY date DESC"; + +$ep_retrieve = "SELECT + hosts.host, + eps.id, + eps.title, + eps.date, + COUNT( assets.extension) AS numfiles +FROM + eps + LEFT JOIN hosts ON eps.hostid = hosts.hostid + LEFT JOIN assets ON eps.id = assets.episode_id +WHERE + eps.valid = 1 + AND eps.date >= '$current_episode_date' +GROUP BY eps.id;"; + +if ($result = mysqli_query($connection, $ep_retrieve)) { + while ($row = mysqli_fetch_array($result)) { + $id = $row['id']; + $date = $row['date']; + $title = $row['title']; + $host = $row['host']; + $numfiles = $row['numfiles']; + if( isset($numfiles) and $numfiles >= 3 ) { + $status = "Finished"; + } + else { + $status = "Reserved"; + } + $show_array[$id] = array ( "date" => date('Y-m-d', strtotime($date) ), + "title" => $title, + "host" => $host, + "status" => $status + ); + } +} +// REQUEST_UNVERIFIED → SHOW_SUBMITTED → METADATA_PROCESSED → SHOW_POSTED → MEDIA_TRANSCODED → UPLOADED_TO_IA → UPLOADED_TO_RSYNC_NET + +// Populate array with currently processing shows EMAIL_LINK_CLICKED +$ep_retrieve = " +SELECT + reservations.ep_num, + reservations.ep_date, + reservations.status +FROM + reservations +WHERE + reservations.verified = 1 + AND reservations.ep_date >= '$current_episode_date' +ORDER BY + reservations.ep_date DESC"; + +if ($result = mysqli_query($connection, $ep_retrieve)) { + while ($row = mysqli_fetch_array($result)) { + $id = $row['ep_num']; + $date = $row['ep_date']; + $status = $row['status']; + $show_array[$id] = array ( "date" => date('Y-m-d', strtotime($date) ), + "title" => $status, + "host" => "Unverified", + "status" => "Processing" + ); + } +} + +// Populate array with temporary reservations. +$ep_retrieve = "SELECT r.ep_num, r.ep_date, r.timestamp + INTERVAL 1 HOUR - UTC_TIMESTAMP() AS seconds_to_expiration FROM reservations r +WHERE r.timestamp + INTERVAL 1 HOUR > UTC_TIMESTAMP() AND r.verified =0 AND r.ep_date >= '$current_episode_date' ORDER BY r.ep_date DESC"; + +if ($result = mysqli_query($connection, $ep_retrieve)) { + while ($row = mysqli_fetch_array($result)) { + $id = $row['ep_num']; + $date = $row['ep_date']; + $seconds_to_expiration = $row['seconds_to_expiration']; + $minutes = floor($seconds_to_expiration / 60) + 1; + $show_array[$id] = array ( "date" => date('Y-m-d', strtotime($date) ), + "title" => " Available again in $minutes minutes", + "host" => "Unverified", + "status" => "Locked" + ); + } +} + +$ep_retrieve = "SELECT + hosts.host, + eps.id, + eps.title, + eps.date +FROM + eps, + hosts, + assets +WHERE + eps.valid = 0 + AND eps.hostid = hosts.hostid + AND eps.id = assets.episode_id + AND eps.date >= '$current_episode_date' +ORDER BY + date DESC"; +if ($result = mysqli_query($connection, $ep_retrieve)) { + while ($row = mysqli_fetch_array($result)) { + $id = $row['id']; + $date = $row['date']; + $title = $row['title']; + $host = $row['host']; + $show_array[$id] = array ( "date" => date('Y-m-d', strtotime($date) ), + "title" => $title, + "host" => $host, + "status" => "Distributing media to the ccdn" + ); + } +} + +$ep_retrieve = "SELECT + hosts.host, + eps.id, + eps.title, + eps.date +FROM + eps, + hosts, + assets +WHERE + eps.valid = 1 + AND eps.hostid = hosts.hostid + AND eps.id = assets.episode_id + AND assets.extension = 'ogg' + AND eps.date >= '$current_episode_date' +ORDER BY + date DESC"; +if ($result = mysqli_query($connection, $ep_retrieve)) { + while ($row = mysqli_fetch_array($result)) { + $id = $row['id']; + $date = $row['date']; + $title = $row['title']; + $host = $row['host']; + $show_array[$id] = array ( "date" => date('Y-m-d', strtotime($date) ), + "title" => $title, + "host" => $host, + "status" => "Finished" + ); + } +} + + +// -------------------------------------------- +// Calculate the time to the next show + +# aria-label="" + +$next_show_date = date('Y-m-d', strtotime($show_array[$next_show_num - 1 ]["date"] . ' + 1 weekday')); +$days_to_wait = floor((strtotime($next_show_date) - strtotime(gmdate('Y-m-d')))/(60*60*24)); + +?> +

Upload Your Show

+ +

+The HPR Schedule is entirely community driven and we recommend that you decide when your show will be released. +

+ +

+There are only days to wait until next free slot. Please consider ">recording a show for us. +

+
    +
  1. Review the updated ">Stuff you need to know page.
  2. +
  3. Select a date, or post to the reserve queue.
  4. +
  5. Click the link in the confirmation email
  6. +
  7. Then ">fill in a form.
  8. +
+ +

Scheduling Rules

+
    +
  1. You must have your audio recording ready to upload before you pick a slot.
  2. +
  3. New hosts, Interviews, and other time critical shows should use the first free slot.
  4. +
  5. Always try and fill any free slots that are available in the upcoming two weeks.
  6. +
  7. If you are uploading a series of shows then post them one every two weeks.
  8. +
+ +

Scheduling Guidelines

+
    +
  1. When the queue is filling up then leave some slots free for new contributors.
  2. +
  3. Post non urgent shows into the first empty week.
  4. +
  5. If you have a non urgent show that is timeless, then add it to the Reserve Queue.
  6. +
+ +

Add to the Reserve Queue ?

+ +

+request.php?id=9999">Post your show to the reserve queue if you don't care when it will be released. about.html#reserve_queue";">ⓘ +

+ +

Select a date in the current schedule ?

+ +

+Schedule the release day your show will be aired. about.html#scheduling_guidelines">ⓘ +

+ +

Next Two Months about.html#workflow">ⓘ

+ + + + +" . date('D Y-m-d', strtotime($show_array[$slot]["date"])) . ": hpr${slot} " . $show_array[$slot]["title"] . " by " . $show_array[$slot]["host"] . "
\n"; + } + else { + echo "${this_episode_date}: hpr${slot} ". $show_array[$slot]["status"]. ": " . $show_array[$slot]["title"] . ".
\n"; + } + $sizeof_show_array--; + } + elseif ( empty( $show_array[$slot] ) ) { + echo "${this_episode_date}: hpr${slot} is available - upload now.
\n"; + } + elseif ( $show_array[$slot]["valid"] == 0 ) { + echo "${this_episode_date}: hpr${slot} Unavailable.
\n"; + } + $this_episode_date = date('D Y-m-d', strtotime($this_episode_date . ' + 1 weekday')); + $new_week_number = date('W', strtotime($this_episode_date)); + if ( $week_number != $new_week_number ) { + $week_number = $new_week_number; + echo "----------------- Week ${week_number} -----------------
\n"; + } +} +?> + +

Also Scheduled

+\n" ; + if ( !empty( $show_array[$slot] ) ) { + if ( $show_array[$slot]["status"] === "Finished" ) { + echo "" . date('D Y-m-d', strtotime($show_array[$slot]["date"])) . ": hpr${slot} " . $show_array[$slot]["title"] . " by " . $show_array[$slot]["host"] . "
\n"; + } + else { + echo "" . date('D Y-m-d', strtotime($show_array[$slot]["date"])) . ": hpr${slot} ". $show_array[$slot]["status"]. ": " . $show_array[$slot]["title"] . ".
\n"; + } + + $sizeof_show_array--; + } + $slot++; +} +?> + +

Reserve Queue Overview

+
+
+
+ +

Pick other dates

+

+If you wish to pick an available slot in the next 12 months then go directly to the request.php">request page. +

+ +

Workflow

+

+The HPR statistics are regenerated every 15 minutes and are available in stats.json">json format. Note the format is liable to change without notice.

+ diff --git a/hub/request.php b/hub/request.php index 8fcde3f..36e40a6 100644 --- a/hub/request.php +++ b/hub/request.php @@ -129,7 +129,7 @@ if (isset($_GET['id'])){ if ( $id != 9999 ) { if ( isset( $show_array[$id] ) ) { - naughty("2227263ac7171aca3214d155dec539ad The id is still too high"); + naughty("2227263ac7171aca3214d155dec539ad The id \"${id}\" is already reserved"); } } }