The show processing needs to be refactored #5
This commit is contained in:
parent
821b7ff1b6
commit
a6044e16a7
74
cms/say.php
74
cms/say.php
@ -1,10 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
require "/home/hpr/php/include.php";
|
require "/home/hpr/php/include.php";
|
||||||
|
|
||||||
|
date_default_timezone_set('UTC');
|
||||||
|
|
||||||
if (isset($_GET['id'])) {
|
if (isset($_GET['id'])) {
|
||||||
$id = $_GET['id'];
|
$id = $_GET['id'];
|
||||||
$result = mysqli_query($connection, 'SELECT MAX(id) FROM eps;');
|
$result = mysqli_query($connection, 'SELECT MAX(id) FROM eps;');
|
||||||
if (!isset($result)) {
|
if (!isset($result)) {
|
||||||
|
problem( "45f606ad99fe4fca7430b7b5bba1c681" );
|
||||||
die('Could not query:' . mysqli_error());
|
die('Could not query:' . mysqli_error());
|
||||||
}
|
}
|
||||||
$maxhost_array = mysqli_fetch_row( $result );
|
$maxhost_array = mysqli_fetch_row( $result );
|
||||||
@ -14,26 +17,25 @@ if (isset($_GET['id'])) {
|
|||||||
++$num_get_args;
|
++$num_get_args;
|
||||||
}
|
}
|
||||||
if ( (strval(intval($id)) != strval($id)) OR ( intval($id) <= 0 ) OR ( intval($id) > $maxhost ) OR ( $num_get_args > 1 ) ){
|
if ( (strval(intval($id)) != strval($id)) OR ( intval($id) <= 0 ) OR ( intval($id) > $maxhost ) OR ( $num_get_args > 1 ) ){
|
||||||
|
problem( "ea860134910fecd136229e45262709d7" );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$query = "SELECT id FROM eps WHERE id = '$id'";
|
$query = "SELECT id FROM eps WHERE id = '$id'";
|
||||||
$result = @mysqli_query($connection, $query);
|
$result = @mysqli_query($connection, $query);
|
||||||
if($result === FALSE) {
|
if($result === FALSE) {
|
||||||
call412( "dc5b8dae7ea2a7e70ac0b7ea65ce2d12" );
|
problem( "dc5b8dae7ea2a7e70ac0b7ea65ce2d12" );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$db = mysqli_fetch_array($result, MYSQLI_ASSOC);
|
$db = mysqli_fetch_array($result, MYSQLI_ASSOC);
|
||||||
if ( empty($db["id"]) ) {
|
if ( empty($db["id"]) ) {
|
||||||
call412( "2b6462ff2389405a796066dfc73ccf55" );
|
problem( "2b6462ff2389405a796066dfc73ccf55" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
call412( "ae1f3471af22d32d3bf2efc9130a00ae" );
|
problem( "ae1f3471af22d32d3bf2efc9130a00ae" );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
Header('Content-type: text/tab-separated-values');
|
|
||||||
header("Content-disposition: inline; filename=say.txt");
|
|
||||||
|
|
||||||
$ep_retrieve = "SELECT
|
$ep_retrieve = "SELECT
|
||||||
UNIX_TIMESTAMP(eps.date) AS timestamp,
|
UNIX_TIMESTAMP(eps.date) AS timestamp,
|
||||||
@ -88,42 +90,62 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$HPR_summary = "This is Hacker Public Radio episode $id for " . date("l", $date) . " the " . date("jS", $date) . " of " . date("F Y", $date) . ". Todays show is entitled. ${title}.";
|
else {
|
||||||
|
http_response_code(404);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$synopsis = "This is Hacker Public Radio episode $id for " . date("l", $date) . " the " . date("jS", $date) . " of " . date("F Y", $date) . ". Todays show is entitled. ${title}.";
|
||||||
if ($series > "0"){
|
if ($series > "0"){
|
||||||
$series_query = mysqli_query($connection, "SELECT name, description FROM miniseries WHERE id = '$series'");
|
$series_query = mysqli_query($connection, "SELECT name, description FROM miniseries WHERE id = '$series'");
|
||||||
$series_result = mysqli_fetch_array($series_query);
|
$series_result = mysqli_fetch_array($series_query);
|
||||||
$series_title = $series_result['name'];
|
$series_title = $series_result['name'];
|
||||||
$desc = $series_result['description'];
|
$desc = $series_result['description'];
|
||||||
$HPR_summary = "${HPR_summary} It is part of the series \"$series_title\"";
|
$synopsis = "${synopsis} It is part of the series \"$series_title\"";
|
||||||
}
|
}
|
||||||
$HPR_summary = "${HPR_summary} ${host_notes} and is about " . round($duration/60) . " minutes long. It carries ";
|
$synopsis = "${synopsis} ${host_notes} and is about " . round($duration/60) . " minutes long. It carries ";
|
||||||
if ($explicit == 0) {
|
if ($explicit == 0) {
|
||||||
$HPR_summary = "${HPR_summary} a clean flag. ";
|
$synopsis = "${synopsis} a clean flag. ";
|
||||||
$explicit = "Clean";
|
$explicit = "Clean";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$HPR_summary = "${HPR_summary} an explicit flag. ";
|
$synopsis = "${synopsis} an explicit flag. ";
|
||||||
$explicit = "Explicit";
|
$explicit = "Explicit";
|
||||||
}
|
}
|
||||||
if ( !empty( $summary ) ) {
|
if ( !empty( $summary ) ) {
|
||||||
$HPR_summary = "${HPR_summary}. The summary is. $summary";
|
$synopsis = "${synopsis}. The summary is. $summary";
|
||||||
}
|
}
|
||||||
if (strcmp($license, "CC-BY-SA" ) !== 0) {
|
if (strcmp($license, "CC-BY-SA" ) !== 0) {
|
||||||
$HPR_summary = "${HPR_summary}. Todays show is licensed under a $license_long_name license.";
|
$synopsis = "${synopsis}. Todays show is licensed under a $license_long_name license.";
|
||||||
}
|
}
|
||||||
|
|
||||||
$HPR_summary = str_replace($host,$espeak_name,$HPR_summary);
|
$synopsis = str_replace($host,$espeak_name,$synopsis);
|
||||||
|
|
||||||
echo "HPR_summary: ${HPR_summary}\n";
|
// --------------------------------------------
|
||||||
echo "HPR_album: Hacker Public Radio\n";
|
// Display the results
|
||||||
echo "HPR_artist: ${host}\n";
|
|
||||||
echo "HPR_hostid: ${hostid}\n";
|
$arr = array(
|
||||||
echo "HPR_comment: https://hackerpublicradio.org ${explicit}; $summary\n";
|
'genre' => "Podcast",
|
||||||
echo "HPR_genre: Podcast\n";
|
'album' => "Hacker Public Radio",
|
||||||
echo "HPR_license: ${license}\n";
|
'track' => "$id",
|
||||||
echo "HPR_title: ${title}\n";
|
'year' => date("Y", $date),
|
||||||
echo "HPR_track: $id\n";
|
'date' => date("Y-m-d", $date),
|
||||||
echo "HPR_year: " . date("Y", $date) . "\n";
|
'artist' => "${host}",
|
||||||
echo "HPR_duration: ${duration}\n";
|
'hostid' => "${hostid}",
|
||||||
echo "HPR_explicit: ${explicit}\n";
|
'title' => "${title}",
|
||||||
?>
|
'duration' => "${duration}",
|
||||||
|
'license' => "${license}",
|
||||||
|
'explicit' => "${explicit}",
|
||||||
|
'summary' => "${summary}",
|
||||||
|
'comment' => "https://hackerpublicradio.org ${explicit}; $summary",
|
||||||
|
'synopsis' => "${synopsis}"
|
||||||
|
);
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
header("Content-disposition: inline; filename=hpr_stats.json");
|
||||||
|
|
||||||
|
echo json_encode($arr);
|
||||||
|
|
||||||
|
mysqli_close($connection);
|
||||||
|
@ -42,7 +42,7 @@ $current_episode_number = $current_episode_array[1];
|
|||||||
// Populate array with future shows and reservations
|
// Populate array with future shows and reservations
|
||||||
$show_array = array ();
|
$show_array = array ();
|
||||||
|
|
||||||
// REQUEST_UNVERIFIED → SHOW_SUBMITTED → METADATA_PROCESSED → SHOW_POSTED → MEDIA_TRANSCODED → UPLOADED_TO_IA → UPLOADED_TO_RSYNC_NET
|
// REQUEST_UNVERIFIED → SHOW_SUBMITTED → METADATA_PROCESSED → SHOW_POSTED → MEDIA_TRANSCODED → UPLOADED_TO_IA → UPLOADED_TO_CCDN
|
||||||
$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 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
|
$ep_retrieve = "SELECT
|
||||||
@ -76,11 +76,12 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
|
|||||||
$show_array[$id] = array ( "date" => date('Y-m-d', strtotime($date) ),
|
$show_array[$id] = array ( "date" => date('Y-m-d', strtotime($date) ),
|
||||||
"title" => $title,
|
"title" => $title,
|
||||||
"host" => $host,
|
"host" => $host,
|
||||||
"status" => $status
|
"status" => $status,
|
||||||
|
"workflow" => $status
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// REQUEST_UNVERIFIED → SHOW_SUBMITTED → METADATA_PROCESSED → SHOW_POSTED → MEDIA_TRANSCODED → UPLOADED_TO_IA → UPLOADED_TO_RSYNC_NET
|
// REQUEST_UNVERIFIED → SHOW_SUBMITTED → METADATA_PROCESSED → SHOW_POSTED → MEDIA_TRANSCODED → UPLOADED_TO_IA → UPLOADED_TO_CCDN
|
||||||
|
|
||||||
// Populate array with currently processing shows EMAIL_LINK_CLICKED
|
// Populate array with currently processing shows EMAIL_LINK_CLICKED
|
||||||
$ep_retrieve = "
|
$ep_retrieve = "
|
||||||
@ -104,7 +105,8 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
|
|||||||
$show_array[$id] = array ( "date" => date('Y-m-d', strtotime($date) ),
|
$show_array[$id] = array ( "date" => date('Y-m-d', strtotime($date) ),
|
||||||
"title" => $status,
|
"title" => $status,
|
||||||
"host" => "Unverified",
|
"host" => "Unverified",
|
||||||
"status" => "Processing"
|
"status" => "Processing",
|
||||||
|
"workflow" => $status
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -122,7 +124,8 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
|
|||||||
$show_array[$id] = array ( "date" => date('Y-m-d', strtotime($date) ),
|
$show_array[$id] = array ( "date" => date('Y-m-d', strtotime($date) ),
|
||||||
"title" => " Available again in $minutes minutes",
|
"title" => " Available again in $minutes minutes",
|
||||||
"host" => "Unverified",
|
"host" => "Unverified",
|
||||||
"status" => "Locked"
|
"status" => "Locked",
|
||||||
|
"workflow" => "Locked"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,7 +156,8 @@ if ($result = mysqli_query($connection, $ep_retrieve)) {
|
|||||||
$show_array[$id] = array ( "date" => date('Y-m-d', strtotime($date) ),
|
$show_array[$id] = array ( "date" => date('Y-m-d', strtotime($date) ),
|
||||||
"title" => $title,
|
"title" => $title,
|
||||||
"host" => $host,
|
"host" => $host,
|
||||||
"status" => "Finished"
|
"status" => "Finished",
|
||||||
|
"workflow" => "Finished"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
126
cms/shownotes.php
Normal file
126
cms/shownotes.php
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
<?php
|
||||||
|
require "/home/hpr/php/include.php";
|
||||||
|
|
||||||
|
date_default_timezone_set('UTC');
|
||||||
|
|
||||||
|
if (isset($_GET['id'])) {
|
||||||
|
$id = $_GET['id'];
|
||||||
|
$result = mysqli_query($connection, 'SELECT MAX(id) FROM eps;');
|
||||||
|
if (!isset($result)) {
|
||||||
|
problem( "d7f47a123af3ea10628ce44d2146b40e" );
|
||||||
|
die('Could not query:' . mysqli_error());
|
||||||
|
}
|
||||||
|
$maxhost_array = mysqli_fetch_row( $result );
|
||||||
|
$maxhost = $maxhost_array[0];
|
||||||
|
$num_get_args=0;
|
||||||
|
foreach($_GET as $k => $v) {
|
||||||
|
++$num_get_args;
|
||||||
|
}
|
||||||
|
if ( (strval(intval($id)) != strval($id)) OR ( intval($id) <= 0 ) OR ( intval($id) > $maxhost ) OR ( $num_get_args > 1 ) ){
|
||||||
|
problem( "5d45cb79dd9426e7e4ab5595ac647a62" );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$query = "SELECT id FROM eps WHERE id = '$id'";
|
||||||
|
$result = @mysqli_query($connection, $query);
|
||||||
|
if($result === FALSE) {
|
||||||
|
problem( "b26e5cea3779b66c76bf1c3c266e1a51" );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$db = mysqli_fetch_array($result, MYSQLI_ASSOC);
|
||||||
|
if ( empty($db["id"]) ) {
|
||||||
|
problem( "a5d5eab30290ba4460ceb337add11821" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
problem( "39122c23e90fcf5cb9ca9e03a5c5a3c5" );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ep_retrieve = "SELECT
|
||||||
|
UNIX_TIMESTAMP(eps.date) AS timestamp,
|
||||||
|
eps.title,
|
||||||
|
eps.duration,
|
||||||
|
eps.summary,
|
||||||
|
eps.tags,
|
||||||
|
hosts.host,
|
||||||
|
hosts.email,
|
||||||
|
hosts.license as host_license,
|
||||||
|
hosts.profile,
|
||||||
|
eps.hostid,
|
||||||
|
eps.series,
|
||||||
|
eps.notes,
|
||||||
|
miniseries.name as series_name,
|
||||||
|
eps.license as show_license,
|
||||||
|
eps.explicit
|
||||||
|
FROM
|
||||||
|
eps
|
||||||
|
LEFT JOIN hosts ON eps.hostid = hosts.hostid
|
||||||
|
LEFT JOIN miniseries ON miniseries.id = eps.series
|
||||||
|
WHERE
|
||||||
|
hosts.valid = '1'
|
||||||
|
AND eps.id = '$id'";
|
||||||
|
if ($result = mysqli_query($connection, $ep_retrieve)) {
|
||||||
|
while ($row = mysqli_fetch_array($result)) {
|
||||||
|
$date = $row['timestamp'];
|
||||||
|
$title = $row['title'];
|
||||||
|
$duration = $row['duration'];
|
||||||
|
$summary = $row['summary'];
|
||||||
|
$host = $row['host'];
|
||||||
|
$hostid = $row['hostid'];
|
||||||
|
$host_email = $row['email'];
|
||||||
|
$host_license = $row['host_license'];
|
||||||
|
$host_profile = $row['profile'];
|
||||||
|
$series = $row['series'];
|
||||||
|
$series_name = $row['series_name'];
|
||||||
|
$show_license = $row['show_license'];
|
||||||
|
$explicit = $row['explicit'];
|
||||||
|
$tags = $row['tags'];
|
||||||
|
$notes = $row['notes'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
http_response_code(404);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($explicit == 0) {
|
||||||
|
$explicit = "Clean";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$explicit = "Explicit";
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------
|
||||||
|
// Display the results
|
||||||
|
|
||||||
|
$arr = array(
|
||||||
|
'host' => array (
|
||||||
|
'Host_ID' => "${hostid}",
|
||||||
|
'Host_Name' => "${host}",
|
||||||
|
'Host_Email' => "${host_email}",
|
||||||
|
'Host_License' => "${host_license}",
|
||||||
|
'Host_Profile' => "${host_profile}"
|
||||||
|
),
|
||||||
|
'episode' => array (
|
||||||
|
'Title' => "${title}",
|
||||||
|
'Summary' => "${summary}",
|
||||||
|
'Explicit' => "${explicit}",
|
||||||
|
'Show_License' => "${show_license}",
|
||||||
|
'Series' => "${series}",
|
||||||
|
'Series_Name' => "${series_name}",
|
||||||
|
'Tags' => "${tags}",
|
||||||
|
'Show_Notes' => "${notes}"
|
||||||
|
),
|
||||||
|
'metadata' => array (
|
||||||
|
'Episode_Number' => "${id}",
|
||||||
|
'Episode_Date' => date("Y-m-d", $date)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
header("Content-disposition: inline; filename=hpr_stats.json");
|
||||||
|
|
||||||
|
echo json_encode($arr);
|
||||||
|
|
||||||
|
mysqli_close($connection);
|
Loading…
Reference in New Issue
Block a user