diff --git a/index.php b/index.php index a3605b7..b88daa8 100644 --- a/index.php +++ b/index.php @@ -15,7 +15,7 @@ TildeRadio is Internet radio streamed by / for users of the tildeverse.

Join the conversation Here



- +


diff --git a/schedule/nextdj.php b/schedule/nextdj.php new file mode 100644 index 0000000..131edde --- /dev/null +++ b/schedule/nextdj.php @@ -0,0 +1,54 @@ + [ + "method" => "GET", + ] + ]); + $schedule = json_decode(file_get_contents("https://tilderadio.org/schedule/nextdj.php?json=true", false, $context), true); +} else { + $context = stream_context_create([ + "http" => [ + "method" => "GET", + "header" => "X-API-Key: $apikey\r\n" + ] + ]); + + $schedule = json_decode( + file_get_contents( + "https://radio.tildeverse.org/api/station/1/schedule?rows=2", + false, + $context + ), + true + ); +} + +if (isset($_GET["json"]) && $_GET["json"] === "yes") { + echo json_encode($schedule); +} else { + $data = $schedule[0]; + if ((strtotime($data["start"])-strtotime("now"))<0) { + echo $data["name"]." should be streaming now, and "; + $data = $schedule[1]; + } + echo $data["name"]." will stream at ".gmdate("D M d H:i",strtotime($data["start"]))." UTC (in "; + $diff = strtotime($data["start"])-strtotime("now"); + if ($diff<60) { + echo "".$diff." seconds)"; + } else { + $minutes = intdiv($diff,60); + $seconds = $diff % 60; + if ($minutes<60) { + echo "".$minutes." minutes and ".$seconds." seconds)"; + } else { + $hours = intdiv($minutes,60); + $minutes = $minutes % 60; + echo "".$hours." hours, ".$minutes." minutes and ".$seconds." seconds)"; + } + } + echo "."; +}