diff options
Diffstat (limited to '')
-rw-r--r-- | assets/css/_bootstrap-selection.less | 2 | ||||
-rw-r--r-- | assets/css/_room.less | 25 | ||||
-rw-r--r-- | assets/css/_structure.less | 5 | ||||
-rw-r--r-- | assets/js/lustiges-script.js | 4 | ||||
-rw-r--r-- | config.php | 73 | ||||
-rw-r--r-- | index.php | 12 | ||||
-rw-r--r-- | lib/helper.php | 4 | ||||
-rw-r--r-- | lib/program.php | 37 | ||||
-rw-r--r-- | pages/room.php | 40 | ||||
-rw-r--r-- | template/assemblies/feedback.phtml | 2 | ||||
-rw-r--r-- | template/assemblies/switcher/miniroom-audio.phtml | 12 | ||||
-rw-r--r-- | template/assemblies/switcher/miniroom-video.phtml | 52 | ||||
-rw-r--r-- | template/overview.phtml | 28 | ||||
-rw-r--r-- | template/room.phtml | 52 |
14 files changed, 160 insertions, 188 deletions
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/', @@ -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', ); @@ -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 @@ -<form action="feedback/" target="feedback-target" method="post" role="form" class="feedback-form form-horizontal row"> +<form action="feedback/" target="feedback-target" method="post" role="form" class="feedback-form form-horizontal"> <div class="col-sm-4 col"> <div class="form-group"> <label for="net">Network Connection</label> 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 @@ -<h3>Directlinks</h3> -<ul> - <? foreach(array('mp3', 'opus') as $iter): ?> - <li> - <span class="label filetype" title="<?=h(format_text($iter))?>"><?=h(strtoupper($iter))?></span> - <a href="<?=h(link_stream('audio', $room, $iter))?>"> - <span class="fa fa-flag-o"></span> - audio - </a> - </li> - <? endforeach ?> -</ul> 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 @@ -<h3>Formats</h3> -<ul> - <? foreach(array('hd', 'sd') as $iter): ?> - <li> - <span class="label filetype" title="<?=h(format_text($iter))?>"><?=h(strtoupper($iter))?></span> - <a href="<?=h(link_player($room, $iter))?>"> - <span class="fa fa-flag-o"></span> - video - </a> - </li> - <? endforeach ?> -</ul> - -<hr /> - -<? include("$assemblies/desktop-player.phtml") ?> - -<hr /> - -<? foreach(array('rtmp', 'hls') as $protocol): ?> - <h3>Directlinks (<?=h(strtoupper($protocol))?>)</h3> - <ul> - <? - if($protocol == 'hls') - $formats = array('hd', 'sd', 'auto'); - else - $formats = array('hd', 'sd'); - ?> - <? foreach($formats as $iter): ?> - <li> - <span class="label filetype" title="<?=h(format_text($iter))?>"><?=h(strtoupper($iter))?></span> - <a href="<?=h(link_stream($protocol, $room, $iter))?>"> - <span class="fa fa-flag-o"></span> - video - </a> - </li> - <? endforeach ?> - </ul> -<? endforeach ?> - -<h3>Directlinks (WebM)</h3> -<ul> - <? foreach(array('hd', 'sd') as $iter): ?> - <li> - <span class="label filetype" title="<?=h(format_text('webm'))?>"><?=h(strtoupper($iter))?></span> - <a href="<?=h(link_stream('webm', $room, $iter))?>"> - <span class="fa fa-flag-o"></span> - video - </a> - </li> - <? endforeach ?> -</ul> 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 @@ <? include("$assemblies/banner.phtml") ?> -<div class="container overview"> +<div class="container"> <div class="row headline"> <div class="col-xs-12"> - <h1>Live-Streams</h1> + <h1><?=h($title)?></h1> </div> </div> @@ -14,9 +14,9 @@ </div> <? $count = count($rooms); ?> - <? foreach($rooms as $idx => $slug): ?> + <? foreach($rooms as $idx => $room): ?> <div class=" - room room-<?=h($slug)?> + room room-<?=h($room)?> <? /* when the count is odd and this is the last item - make it full width */ ?> <? if($count % 2 == 1 && $idx == $count - 1): ?> @@ -25,33 +25,33 @@ col-md-6 col-sm-12 narrow <? endif ?> - <? if(get("ROOMS.$slug.PREVIEW")): ?> + <? if(get("ROOMS.$room.PREVIEW")): ?> has-preview <? endif ?> - <? if(get("ROOMS.$slug.SCHEDULE") && has("SCHEDULE")): ?> + <? if(get("ROOMS.$room.SCHEDULE") && has("SCHEDULE")): ?> has-schedule <? endif ?> "> <div class="panel panel-default"> <div class="panel-heading"> - <a href="<?=h(link_room($slug))?>"> - <?=h(get("ROOMS.$slug.DISPLAY"))?> + <a href="<?=h(link_room($room))?>"> + <?=h(get("ROOMS.$room.DISPLAY"))?> </a> </div> <div class="panel-body"> - <? if(get("ROOMS.$slug.PREVIEW")): ?> - <a href="<?=h(link_room($slug))?>"> - <img class="preview" src="thumbs/<?=h(get("ROOMS.$slug.STREAM"))?>.png" alt="" width="213" height="120" /> + <? if(get("ROOMS.$room.PREVIEW")): ?> + <a href="<?=h(link_room($room))?>"> + <img class="preview" src="thumbs/<?=h(get("ROOMS.$room.STREAM"))?>.png" alt="" width="213" height="120" /> </a> <? endif ?> - <a href="<?=h(link_room($slug))?>" class="title"> - <?=h(get("ROOMS.$slug.DISPLAY"))?> + <a href="<?=h(link_room($room))?>" class="title"> + <?=h(get("ROOMS.$room.DISPLAY"))?> </a> - <? if(get("ROOMS.$slug.SCHEDULE") && has("SCHEDULE")): ?> + <? if(get("ROOMS.$room.SCHEDULE") && has("SCHEDULE")): ?> <div class="program-schedule"> <div class="talk current-talk"> <strong>Now:</strong> 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 @@ -<div class="container-fluid room <?=h($type)?> <?=h($format)?> <?=h($language)?>" data-room="<?=h($GLOBALS['CONFIG']['ROOMS'][$room])?>"> - <h1><?=h($title)?></h1> +<div class="container <?=h($type)?> <?=h($selection)?> <?=h($language)?>"> + <div class="row headline"> + <div class="col-xs-12"> + <h1 data-room="<?=h(get("ROOMS.$room.DISPLAY"))?>"><?=h($title)?></h1> + </div> + </div> <ul class="nav nav-tabs nav-justified"> - <? - if($miniroom || $room == 'saal6') - $tabs = array('video', 'audio'); - else - $tabs = array('video', 'audio', 'slides'); - ?> - <? foreach($tabs as $iter): ?> + <? foreach($types as $iter): ?> <li <? if($type == $iter):?>class="active"<? endif ?> > @@ -19,45 +17,51 @@ <? endforeach ?> </ul> - <div class="player-wrap"> - <? include("$assemblies/player/$type.phtml") ?> + <div class="player-wrap tab-content"> + <div class="tab-pane active"> + <? include("$assemblies/player/$type.phtml") ?> + </div> </div> <ul class="nav nav-tabs nav-justified" role="tablist"> <li class="active"> <a href="#switcher" role="tab" data-toggle="tab">Formats</a> </li> - <? if(!$miniroom): ?> + <? if(get("ROOMS.$room.IRC") && has("IRC")): ?> <li> <a href="#irc" role="tab" data-toggle="tab">IRC</a> </li> + <? endif ?> + <? if(get("ROOMS.$room.SCHEDULE") && has("SCHEDULE")): ?> <li> <a href="#program" role="tab" data-toggle="tab">Program</a> </li> <? endif ?> - <li> - <a href="#feedback" role="tab" data-toggle="tab">Feedback</a> - </li> + <? if(get("ROOMS.$room.FEEDBACK") && has("FEEDBACK")): ?> + <li> + <a href="#feedback" role="tab" data-toggle="tab">Feedback</a> + </li> + <? endif ?> </ul> <div class="tab-content"> <div class="tab-pane active" id="switcher"> - <? if($miniroom): ?> - <? include("$assemblies/switcher/miniroom-$type.phtml") ?> - <? else: ?> - <? include("$assemblies/switcher/$type.phtml") ?> - <? endif ?> + <? include("$assemblies/switcher/$type.phtml") ?> </div> - <? if(!$miniroom): ?> + <? if(get("ROOMS.$room.SCHEDULE") && has("SCHEDULE")): ?> <div class="tab-pane" id="irc"> <? include("$assemblies/irc.phtml") ?> </div> + <? endif ?> + <? if(get("ROOMS.$room.FEEDBACK") && has("FEEDBACK")): ?> <div class="tab-pane" id="program"> <? include("$assemblies/program.phtml") ?> </div> <? endif ?> - <div class="tab-pane" id="feedback"> - <? include("$assemblies/feedback.phtml") ?> - </div> + <? if(get("ROOMS.$room.FEEDBACK") && has("FEEDBACK")): ?> + <div class="tab-pane" id="feedback"> + <? include("$assemblies/feedback.phtml") ?> + </div> + <? endif ?> </div> </div> |