diff --git a/djinfo.html b/djinfo.html index 82d23e2..177a8c0 100644 --- a/djinfo.html +++ b/djinfo.html @@ -5,7 +5,7 @@ - + tilderadio dj info diff --git a/footer.php b/footer.php index 081c964..2d301f3 100644 --- a/footer.php +++ b/footer.php @@ -1,6 +1,8 @@ - + + + diff --git a/header.php b/header.php index 1ac1ba4..b126a59 100644 --- a/header.php +++ b/header.php @@ -8,8 +8,8 @@ - - + + @@ -36,4 +36,9 @@
-
\ No newline at end of file +
+
+

+ tilderadio.org +

+
\ No newline at end of file diff --git a/index.php b/index.php index adbd305..b1989fb 100644 --- a/index.php +++ b/index.php @@ -1,16 +1,18 @@ -

- tilderadio.org -

-

+
+ +

tilderadio is internet radio streamed by / for users of the tildeverse.

-TildeRadio is Internet radio streamed by / for users of the tildeverse. + Join us in #tilderadio, + our dedicated IRC channel on tilde.chat

-

Join us in #tilderadio, our dedicated IRC channel on tilde.chat

-

Follow us on Mastodon where we announce when DJ's go live! @tilderadio

+

+ follow us on mastodon where we announce when DJ's go live! + @tilderadio +


@@ -19,13 +21,11 @@ TildeRadio is Internet radio streamed by / for users of the -

-Or use the following links in your media player of choice: -

+

Or use the following links in your media player of choice:


diff --git a/schedule/apikey.php.sample b/schedule/apikey.php.sample index 88b86db..f3092b8 100644 --- a/schedule/apikey.php.sample +++ b/schedule/apikey.php.sample @@ -1,3 +1,2 @@ upcoming broadcasts = $start_ts) && ($ch_ts < $end_ts)); + $start_ts = strtotime($start_date); + $end_ts = strtotime($end_date); + $ch_ts = strtotime($checkdate); + return (($ch_ts >= $start_ts) && ($ch_ts < $end_ts)); } // Create a date range between the schedule start and end dates -$begin = new DateTime($schedule[0]['start']); -$end = new DateTime(end($schedule)['start']); +$begin = new DateTime($schedule[0]['start']); +$end = new DateTime(end($schedule)['start']); $daterange = new DatePeriod($begin, new DateInterval('P1D'), $end); ?> - - - - - - - - - + + + + + + + + + +for ($i = 0; $i < 86400; $i += 1800) { ?> - - - + + + -format('Y-m-d') .' ' .date('H:i:s', $time + $i)); - // Set id for this time span, for referencing in JS. - $props = 'id="show-'.$merge->getTimestamp().'"'; - // We'll now use $merge to see if any shows are airing at this time - $matchedshow = null; - foreach ($schedule as $show) { - if (check_in_range($show['start'], $show['end'], $merge->format('Y-m-d H:i:s'))) { - $matchedshow = $show; - break; - } + format('Y-m-d') . ' ' . date('H:i:s', $time + $i)); + // Set id for this time span, for referencing in JS. + $props = 'id="show-' . $merge->getTimestamp() . '"'; + // We'll now use $merge to see if any shows are airing at this time + $matchedshow = null; + foreach ($schedule as $show) { + if (check_in_range($show['start'], $show['end'], $merge->format('Y-m-d H:i:s'))) { + $matchedshow = $show; + break; + } + } + + $active = false; + if (!$wrotepointer) { + // If current time is in this range, draw pointer. + $end = DateTimeImmutable::createFromMutable($merge)->add($halfhour); + if ($now >= $merge && $now < $end) { + $active = true; + $props .= ' class="active"'; + } + } + echo "\n"; } - $active = false; - if (!$wrotepointer) { - // If current time is in this range, draw pointer. - $end = DateTimeImmutable::createFromMutable($merge)->add($halfhour); - if ($now >= $merge && $now < $end) { - $active = true; - $props .= ' class="active"'; - } - } - echo "\n"; - } -?> + ?> - - + +
- format("d") ?> - format("l") ?> - format("D") ?> -
+ format("d") ?> + format("l") ?> + format("D") ?> +
:00:00"; + if ($matchedshow) { + echo '
' . $matchedshow['title'] . '
'; + // if no match was found, leave an empty node + } + if ($active) { + // Cell height here should be synced with height of '.calendar tbody tr td' in ../css/calendar.css + $height = 32; + $top = round(date_diff($merge, $now)->format('%i') / 30 * ($height-1)); + echo '
'; + $wrotepointer = true; + } + echo "
"; - if ($matchedshow) { - echo '
'.$matchedshow['title'].'
'; - // if no match was found, leave an empty node - } - if ($active) { - // Cell height here should be synced with height of '.calendar tbody tr td' in ../css/calendar.css - $height = 32; - $top = round(date_diff($merge, $now)->format('%i') / 30 * ($height-1)); - echo '
'; - $wrotepointer = true; - } - echo "
diff --git a/schedule/ics.php b/schedule/ics.php index e5d5ff4..b6417b2 100644 --- a/schedule/ics.php +++ b/schedule/ics.php @@ -1,6 +1,6 @@ diff --git a/schedule/index.php b/schedule/index.php index b1a4886..1c56337 100644 --- a/schedule/index.php +++ b/schedule/index.php @@ -1,13 +1,19 @@ '; -include '../header.php'; +$additional_head=' +'; +include __DIR__ . '/../header.php'; include 'schedule.php'; ?> -

tilderadio logotilderadio.org

-

all times in UTC. current time is -().

-

this schedule is also available in iCalendar format. point your calendar client at https://tilderadio.org/schedule/ics.php.

+

+ all times in UTC. current time is + (). +

+ +

+ this schedule is also available in iCalendar format. + point your calendar client at https://tilderadio.org/schedule/ics.php. +

- + diff --git a/schedule/nextdj.php b/schedule/nextdj.php index 77010e3..69adf81 100644 --- a/schedule/nextdj.php +++ b/schedule/nextdj.php @@ -2,53 +2,54 @@ include 'apikey.php'; if (empty($apikey)) { - /* 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/nextdj.php?json=true", false, $context), true); + /* 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/nextdj.php?json=true", false, $context), true); } else { - $context = stream_context_create([ - "http" => [ - "method" => "GET", - "header" => "X-API-Key: $apikey\r\n" - ] - ]); + $context = stream_context_create([ + "http" => [ + "method" => "GET", + "header" => "X-API-Key: $apikey\r\n" + ] + ]); - $schedule = json_decode( - file_get_contents( - "https://azuracast.tilderadio.org/api/station/1/schedule?rows=2", - false, - $context - ), - true - ); + $schedule = json_decode( + file_get_contents( + "https://azuracast.tilderadio.org/api/station/1/schedule?rows=2", + false, + $context + ), + true + ); } if (isset($_GET["json"]) && $_GET["json"] === "yes") { - echo json_encode($schedule); + 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 "."; + $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 "."; } diff --git a/schedule/schedule.php b/schedule/schedule.php index d4d1490..6d327cd 100644 --- a/schedule/schedule.php +++ b/schedule/schedule.php @@ -2,35 +2,35 @@ include 'apikey.php'; if (empty($apikey)) { - /* 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); + /* 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" => [ + $context = stream_context_create([ + "http" => [ "method" => "GET", "header" => "X-API-Key: $apikey\r\n" - ] - ]); + ] + ]); - // allow ics.php to overwrite $from and $to - if (!isset($from,$to)) { - $from = gmdate("Y-m-d\TH:i:s\Z", strtotime("now + 1 day")); - $to = gmdate("Y-m-d\TH:i:s\Z", strtotime("now + 8 days")); - } + // allow ics.php to overwrite $from and $to + if (!isset($from, $to)) { + $from = gmdate("Y-m-d\TH:i:s\Z", strtotime("now + 1 day")); + $to = gmdate("Y-m-d\TH:i:s\Z", strtotime("now + 8 days")); + } - $schedule = json_decode( - file_get_contents( - "https://azuracast.tilderadio.org/api/station/1/streamers/schedule?start=$from&end=$to", - false, - $context - ), - true - ); + $schedule = json_decode( + file_get_contents( + "https://azuracast.tilderadio.org/api/station/1/streamers/schedule?start=$from&end=$to", + false, + $context + ), + true + ); } usort($schedule, function ($a, $b) {