aboutsummaryrefslogtreecommitdiff
path: root/view/streams-json-v2.php
diff options
context:
space:
mode:
authorMaZderMind2016-12-20 23:21:20 +0100
committerMaZderMind2016-12-20 23:21:20 +0100
commit9af641e5854d6edb83be6666794eb4d5371dcd8f (patch)
tree489bc3fd4a838d0489a4db35c1f2db73b8f1a5d8 /view/streams-json-v2.php
parent6776bbbc887895b1dccd2dcb416a34958b4bc0a1 (diff)
parent4a7a7ed1bcc6f36fb18f7f564d8f43a7e64a2e48 (diff)
Merge branch 'master' into events/33c3
Diffstat (limited to 'view/streams-json-v2.php')
-rw-r--r--view/streams-json-v2.php105
1 files changed, 105 insertions, 0 deletions
diff --git a/view/streams-json-v2.php b/view/streams-json-v2.php
new file mode 100644
index 0000000..524f2db
--- /dev/null
+++ b/view/streams-json-v2.php
@@ -0,0 +1,105 @@
+<?php
+
+header('Content-Type: application/json');
+
+foreach (Conferences::getActiveConferences() as $conference)
+{
+ $overview = $conference->getOverview();
+
+ $groupstruct = array();
+ foreach($overview->getGroups() as $group => $rooms)
+ {
+ $roomstruct = array();
+ foreach($rooms as $room)
+ {
+ $streams = array();
+ foreach($room->getStreams() as $stream)
+ {
+ $key = $stream->getSelection().'-'.$stream->getLanguage();
+
+ $urls = array();
+ switch($stream->getPlayerType())
+ {
+ case 'video':
+ foreach ($stream->getVideoProtos() as $proto => $display)
+ {
+ $urls[$proto] = array(
+ 'display' => $display,
+ 'tech' => $stream->getVideoTech($proto),
+ 'url' => $stream->getVideoUrl($proto),
+ );
+ }
+ break;
+
+ case 'slides':
+ foreach ($stream->getSlidesProtos() as $proto => $display)
+ {
+ $urls[$proto] = array(
+ 'display' => $display,
+ 'tech' => $stream->getSlidesTech($proto),
+ 'url' => $stream->getSlidesUrl($proto),
+ );
+ }
+ break;
+
+ case 'audio':
+ foreach ($stream->getAudioProtos() as $proto => $display)
+ {
+ $urls[$proto] = array(
+ 'display' => $display,
+ 'tech' => $stream->getAudioTech($proto),
+ 'url' => $stream->getAudioUrl($proto),
+ );
+ }
+ break;
+
+ case 'music':
+ foreach ($stream->getMusicProtos() as $proto => $display)
+ {
+ $urls[$proto] = array(
+ 'display' => $display,
+ 'tech' => $stream->getMusicTech($proto),
+ 'url' => $stream->getMusicUrl($proto),
+ );
+ }
+ break;
+ }
+
+ $streams[] = array(
+ 'slug' => $key,
+ 'display' => $stream->getDisplay(),
+ 'type' => $stream->getPlayerType(),
+ 'isTranslated' => $stream->isTranslated(),
+ 'videoSize' => $stream->getVideoSize(),
+ 'urls' => $urls,
+ );
+ }
+
+ $roomstruct[] = array(
+ 'slug' => $room->getSlug(),
+ 'schedulename' => $room->getScheduleName(),
+ 'thumb' => forceslash(baseurl()).$room->getThumb(),
+ 'link' => forceslash(baseurl()).$room->getLink(),
+ 'display' => $room->getDisplay(),
+ 'streams' => $streams,
+ );
+ }
+
+ $groupstruct[] = array(
+ 'group' => $group,
+ 'rooms' => $roomstruct,
+ );
+ }
+ $struct[] = array(
+ 'conference' => $conference->getTitle(),
+ 'slug' => $conference->getSlug(),
+ 'author' => $conference->getAuthor(),
+ 'description' => $conference->getDescription(),
+ 'keywords' => $conference->getKeywords(),
+ 'startsAt' => $conference->startsAt() ? $conference->startsAt()->format(DateTime::ISO8601) : null,
+ 'endsAt' => $conference->endsAt() ? $conference->endsAt()->format(DateTime::ISO8601) : null,
+ 'groups' => $groupstruct,
+ );
+}
+
+echo json_encode($struct, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);