allow for remote development of schedule by pointing to live schedule json in dev

This commit is contained in:
James Tomasino 2020-09-26 19:02:06 +00:00
parent af00cded1e
commit 76c878d65a
1 changed files with 29 additions and 23 deletions

View File

@ -2,9 +2,14 @@
include 'apikey.php';
if (empty($apikey)) {
die("missing api key");
}
/* If we don't have the API key, assume we're developing. Pull data from live version of this file */
$context = stream_context_create([
"http" => [
"method" => "GET",
]
]);
$schedule = json_decode(file_get_contents("https://tilderadio.org/schedule/schedule.php?json=yes", false, $context), true);
} else {
$context = stream_context_create([
"http" => [
"method" => "GET",
@ -26,6 +31,7 @@ $schedule = json_decode(
),
true
);
}
usort($schedule, function ($a, $b) {
return $a["start"] <=> $b["start"];