From 18031079f5ca57cdac6aa4ab4c236182329bc1f7 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Fri, 27 Feb 2015 17:21:51 +0100 Subject: Work on Room-Page --- assets/css/_bootstrap-selection.less | 2 +- assets/css/_room.less | 25 ++++++++ assets/css/_structure.less | 5 +- assets/js/lustiges-script.js | 4 -- config.php | 73 +++++++---------------- index.php | 12 ++-- lib/helper.php | 4 +- lib/program.php | 37 +++++++++--- pages/room.php | 40 +++++++++---- template/assemblies/feedback.phtml | 2 +- template/assemblies/switcher/miniroom-audio.phtml | 12 ---- template/assemblies/switcher/miniroom-video.phtml | 52 ---------------- template/overview.phtml | 28 ++++----- template/room.phtml | 52 ++++++++-------- 14 files changed, 160 insertions(+), 188 deletions(-) create mode 100644 assets/css/_room.less delete mode 100644 template/assemblies/switcher/miniroom-audio.phtml delete mode 100644 template/assemblies/switcher/miniroom-video.phtml diff --git a/assets/css/_bootstrap-selection.less b/assets/css/_bootstrap-selection.less index 3be8064..55c51b8 100644 --- a/assets/css/_bootstrap-selection.less +++ b/assets/css/_bootstrap-selection.less @@ -21,7 +21,7 @@ //@import "bootstrap-3.3.2/dropdowns.less"; @import "bootstrap-3.3.2/button-groups.less"; @import "bootstrap-3.3.2/input-groups.less"; -//@import "bootstrap-3.3.2/navs.less"; +@import "bootstrap-3.3.2/navs.less"; @import "bootstrap-3.3.2/navbar.less"; //@import "bootstrap-3.3.2/breadcrumbs.less"; //@import "bootstrap-3.3.2/pagination.less"; diff --git a/assets/css/_room.less b/assets/css/_room.less new file mode 100644 index 0000000..3bb9d81 --- /dev/null +++ b/assets/css/_room.less @@ -0,0 +1,25 @@ +video, audio { + display: block; +} + +.tab-content { + border-left: 1px solid #ddd; + border-bottom: 1px solid #ddd; + border-right: 1px solid #ddd; + + padding: 40px 0; +} + +.video.hd .tab-content { + padding: 0; +} + +@media (max-width: @screen-md-max) { + .video.sd .tab-content { + padding: 0; + } +} + +.player-wrap { + margin-bottom: 60px; +} diff --git a/assets/css/_structure.less b/assets/css/_structure.less index 71eea0f..970425d 100644 --- a/assets/css/_structure.less +++ b/assets/css/_structure.less @@ -22,6 +22,9 @@ body { } -.overview { +body.overview { @import "_overview.less"; } +body.room { + @import "_room.less"; +} diff --git a/assets/js/lustiges-script.js b/assets/js/lustiges-script.js index de7d137..accedb9 100644 --- a/assets/js/lustiges-script.js +++ b/assets/js/lustiges-script.js @@ -152,10 +152,6 @@ $(function() { })(mejs.i18n.locale.strings); $('video').mediaelementplayer({ - mode: 'auto_plugin', - - // hack z-index so that the flash plugin get's the click on the fullscreen button - usePluginFullScreen: true, enableAutosize: true, pluginPath: 'assets/js/lib/', diff --git a/config.php b/config.php index 55b0e93..f39a4a6 100644 --- a/config.php +++ b/config.php @@ -350,7 +350,14 @@ $GLOBALS['CONFIG']['ROOMS'] = array( * Wird dieser Block auskommentiert, werden alle Fahrplan-Bezogenen Features deaktiviert */ $GLOBALS['CONFIG']['SCHEDULE'] = array( - 'URL' => 'http://events.ccc.de/congress/2014/Fahrplan/schedule.xml', + /** + * URL zum Fahrplan-XML + * + * Diese URL muss immer verfügbar sein, sonst können kann die Programm-Ansicht + * aufhören zu funktionieren. Wenn die Quelle unverlässlich ist ;) sollte ein + * externer HTTP-Cache vorgeschaltet werden. + */ + 'URL' => 'http://events.ccc.de/congress/2014/Fahrplan/schedule.xml', /** * APCU-Cache-Zeit in Sekunden @@ -478,7 +485,7 @@ $GLOBALS['CONFIG']['TWITTER'] = array( /** - * Konfiguration der Streaming-Formate + * Beschreibung der Streaming-Formate * * Achtung: Über diese Sektion können keine zusätzlichen Formate erstellt werden -- dazu * sind Code-Anpassungen erforderlich. @@ -487,59 +494,21 @@ $GLOBALS['CONFIG']['TWITTER'] = array( * Streaming-Formate bearbeitet werden. Für jedes Streamingformat das in einem Raum * verwendet wird müssen hier Texte hinterlegt sein. */ -$GLOBALS['CONFIG']['FORMATS'] = array( - 'rtmp-sd' => array( - 'DISPLAY' => 'SD Video', - 'TECH' => '1024x576, h264+AAC im FLV-Container via RTMP, 800 kBit/s', - ), - 'rtmp-hd' => array( - 'DISPLAY' => 'FullHD Video', - 'TECH' => '1920x1080, h264+AAC im FLV-Container via RTMP, 3 MBit/s', - ), +$GLOBALS['CONFIG']['FORMAT'] = array( + 'rtmp-sd' => '1024x576, h264+AAC im FLV-Container via RTMP, 800 kBit/s', + 'rtmp-hd' => '1920x1080, h264+AAC im FLV-Container via RTMP, 3 MBit/s', + 'hls-sd' => '1024x576, h264+AAC im MPEG-TS-Container via HTTP, 800 kBit/s', + 'hls-hd' => '1920x1080, h264+AAC im MPEG-TS-Container via HTTP, 3 MBit/s', - 'hls-sd' => array( - 'DISPLAY' => 'SD Video', - 'TECH' => '1024x576, h264+AAC im MPEG-TS-Container via HTTP, 800 kBit/s', - ), - 'hls-hd' => array( - 'DISPLAY' => 'FullHD Video', - 'TECH' => '1920x1080, h264+AAC im MPEG-TS-Container via HTTP, 3 MBit/s', - ), - + 'webm-sd' => '1024x576, VP8+Vorbis in WebM, 800 kBit/s', + 'webm-hd' => '1920x1080, VP8+Vorbis in WebM, 3 MBit/s', - 'webm-sd' => array( - 'DISPLAY' => 'SD Video', - 'TECH' => '1024x576, VP8+Vorbis in WebM, 800 kBit/s', - ), - 'webm-hd' => array( - 'DISPLAY' => 'SD Video', - 'TECH' => '1920x1080, VP8+Vorbis in WebM, 3 MBit/s', - ), + 'audio-mp3' => 'MP3-Audio, 96 kBit/s', + 'audio-opus' => 'Opus-Audio, 64 kBit/s', + 'music-mp3' => 'MP3-Audio, 320 kBit/s', + 'music-opus' => 'Opus-Audio, 128 kBit/s', - 'audio-mp3' => array( - 'DISPLAY' => 'Audio', - 'TECH' => 'MP3-Audio, 96 kBit/s', - ), - 'audio-opus' => array( - 'DISPLAY' => 'Audio', - 'TECH' => 'Opus-Audio, 64 kBit/s', - ), - - - 'music-mp3' => array( - 'DISPLAY' => 'Musik', - 'TECH' => 'MP3-Audio, 320 kBit/s', - ), - 'music-opus' => array( - 'DISPLAY' => 'Musik', - 'TECH' => 'Opus-Audio, 128 kBit/s', - ), - - - 'slides' => array( - 'DISPLAY' => 'Audio', - 'TECH' => '1024x576, h264+AAC, <500 kBit/s', - ), + 'slides' => '1024x576, h264+AAC, <500 kBit/s', ); diff --git a/index.php b/index.php index 7ac4c8e..a5c365d 100644 --- a/index.php +++ b/index.php @@ -14,7 +14,7 @@ else if(preg_match('@^([^/]+)$@', $route, $m)) { $_GET = array( 'room' => $m[1], - 'format' => 'sd', + 'selection' => 'hd', 'language' => 'native', ); include('pages/room.php'); @@ -24,27 +24,27 @@ else if(preg_match('@^([^/]+)/translated$@', $route, $m)) { $_GET = array( 'room' => $m[1], - 'format' => 'sd', + 'selection' => 'hd', 'language' => 'translated', ); include('pages/room.php'); } -else if(preg_match('@^([^/]+)/(hd|audio|slides)$@', $route, $m)) +else if(preg_match('@^([^/]+)/(sd|audio|slides)$@', $route, $m)) { $_GET = array( 'room' => $m[1], - 'format' => $m[2], + 'selection' => $m[2], 'language' => 'native', ); include('pages/room.php'); } -else if(preg_match('@^([^/]+)/(hd|audio|slides)/translated$@', $route, $m)) +else if(preg_match('@^([^/]+)/(sd|audio|slides)/translated$@', $route, $m)) { $_GET = array( 'room' => $m[1], - 'format' => $m[2], + 'selection' => $m[2], 'language' => 'translated', ); include('pages/room.php'); diff --git a/lib/helper.php b/lib/helper.php index 98397e4..deea2c1 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -12,9 +12,9 @@ function link_room($room) return rawurlencode($room).'/'; } -function link_player($room, $format = 'sd', $translated = false) +function link_player($room, $format = 'hd', $translated = false) { - $isDefaultFormat = in_array($format, array('sd', 'video')); + $isDefaultFormat = in_array($format, array('hd', 'video')); return rawurlencode($room).'/'.($isDefaultFormat ? '' : rawurlencode($format).'/').($translated ? 'translated/' : ''); } diff --git a/lib/program.php b/lib/program.php index e85143b..effb63e 100644 --- a/lib/program.php +++ b/lib/program.php @@ -2,22 +2,32 @@ function program() { + if(!has('SCHEDULE')) + return; + + if(has('SCHEDULE.CACHE')) + { + $program = apc_fetch('SCHEDULE.CACHE'); + if($program) return $program; + } + + $program = array(); - $opts = array('http' => array('timeout' => 2, 'user_agent' => 'Fahrplan')); + $opts = array( + 'http' => array( + 'timeout' => 2, + 'user_agent' => 'C3Voc Universal Streaming-Website Backend @ '.$_SERVER['HTTP_HOST'], + ) + ); $context = stream_context_create($opts); - $schedule = file_get_contents('http://fahrplan-31c3.mkswap.net/fahrplan?a=1', false, $context); + $schedule = file_get_contents(get('SCHEDULE.URL'), false, $context); - // loading failed, try tmp-file - if(!$schedule) - $schedule = file_get_contents('/tmp/website-schedule-fallback.xml'); - - // failed, too, give up + // failed, give up if(!$schedule) return array(); - // save tmp-file (for when uplink goes down or such) - file_put_contents('/tmp/website-schedule-fallback.xml', $schedule); $schedule = simplexml_load_string($schedule); + // re-calculate day-ends // some schedules have long gaps before the first talk or talks that expand beyond the dayend // (fiffkon, i look at you) @@ -145,5 +155,14 @@ function program() } } + if(has('SCHEDULE.CACHE')) + { + apc_store( + 'SCHEDULE.CACHE', + $program, + get('SCHEDULE.CACHE') + ); + } + return $program; } diff --git a/pages/room.php b/pages/room.php index 64ca86e..e743d30 100644 --- a/pages/room.php +++ b/pages/room.php @@ -4,50 +4,70 @@ require_once('lib/bootstrap.php'); $room = $_GET['room']; $language = $_GET['language']; -$format = $_GET['format']; +$selection = $_GET['selection']; -switch($format) { +switch($selection) { case 'audio': $type = 'audio'; + $title = 'Audio'; + break; + + case 'music': + $type = 'audio'; + $title = 'Music'; break; case 'slides': $type = 'slides'; + $title = 'Slides'; break; case 'hd': $type = 'video'; + $title = 'FullHD Video'; $width = 1920; $height = 1080; break; case 'sd': $type = 'video'; + $title = 'SD Video'; $width = 1024; $height = 576; break; } -echo $tpl->render(array( - 'page' => 'room', - 'title' => $GLOBALS['CONFIG']['ROOMS'][$room].' – '.$GLOBALS['CONFIG']['FORMATS'][$format], +$formats = get("ROOMS.$room.FORMATS"); +$types = array(); + +if(count(array_intersect(array('rtmp-sd', 'rtmp-hd', 'hls-sd', 'hls-hd', 'webm-sd', 'webm-hd'), $formats)) > 0) + $types[] = 'video'; - 'rooms' => $GLOBALS['CONFIG']['ROOMS'], - 'formats' => $GLOBALS['CONFIG']['FORMATS'], +if(count(array_intersect(array('audio-mp3', 'audio-opus'), $formats)) > 0) + $types[] = 'audio'; +if(count(array_intersect(array('slides'), $formats)) > 0) + $types[] = 'slides'; + + +echo $tpl->render(array( + 'page' => 'room', + + 'title' => get("ROOMS.$room.DISPLAY").' – '.$title, 'room' => $room, - 'roomname' => $GLOBALS['CONFIG']['ROOMS'][$room], 'program' => program(), 'type' => $type, + 'types' => $types, + 'width' => @$width, 'height' => @$height, 'language' => $language, 'translated' => ($language == 'translated'), - 'format' => $format, - 'hlsformat' => ($format == 'sd' ? 'auto' : $format), + 'selection' => $selection, + 'hlsformat' => ($selection == 'hd' ? 'auto' : $selection), // miniroom = no translation, no slides, no irc, no program // -> sendezentrum, workshops diff --git a/template/assemblies/feedback.phtml b/template/assemblies/feedback.phtml index 0ca00e3..6633d32 100644 --- a/template/assemblies/feedback.phtml +++ b/template/assemblies/feedback.phtml @@ -1,4 +1,4 @@ -
+
diff --git a/template/assemblies/switcher/miniroom-audio.phtml b/template/assemblies/switcher/miniroom-audio.phtml deleted file mode 100644 index 12a7921..0000000 --- a/template/assemblies/switcher/miniroom-audio.phtml +++ /dev/null @@ -1,12 +0,0 @@ -

Directlinks

- diff --git a/template/assemblies/switcher/miniroom-video.phtml b/template/assemblies/switcher/miniroom-video.phtml deleted file mode 100644 index e2f807f..0000000 --- a/template/assemblies/switcher/miniroom-video.phtml +++ /dev/null @@ -1,52 +0,0 @@ -

Formats

- - -
- - - -
- - -

Directlinks ()

- - - -

Directlinks (WebM)

- diff --git a/template/overview.phtml b/template/overview.phtml index 95dceeb..fc9e80b 100644 --- a/template/overview.phtml +++ b/template/overview.phtml @@ -1,9 +1,9 @@ -
+
-

Live-Streams

+

@@ -14,9 +14,9 @@
- $slug): ?> + $room): ?>
+ has-preview - + has-schedule ">
- - - .png" alt="" width="213" height="120" /> + + + .png" alt="" width="213" height="120" /> - - + + - +
Now: diff --git a/template/room.phtml b/template/room.phtml index 1a057f2..e337eda 100644 --- a/template/room.phtml +++ b/template/room.phtml @@ -1,14 +1,12 @@ -
-

+
+
+
+

">

+
+
-
- +
+
+ +
- - - - - +
- +
+ +
-
- -
+ +
+ +
+
-- cgit v1.2.3