From f7d9d592745d1cb5cb2de76ed6ae99be974f1807 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Mon, 30 Mar 2015 16:20:30 +0200 Subject: Implement MVT Pattern based on simple Config options --- lib/helper.php | 174 --------------------------------------------------------- 1 file changed, 174 deletions(-) (limited to 'lib/helper.php') diff --git a/lib/helper.php b/lib/helper.php index 640651b..7423a9c 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -1,46 +1,5 @@ 0; -} - -function room_has_sd($room) -{ - $formats = get("ROOMS.$room.FORMATS"); - return count(array_intersect(array('rtmp-sd', 'hls-sd', 'webm-sd'), $formats)) > 0; -} - -function room_has_video($room) -{ - return room_has_hd($room) || room_has_sd($room); -} - -function room_has_audio($room) -{ - $formats = get("ROOMS.$room.FORMATS"); - return count(array_intersect(array('audio-mp3', 'audio-opus', 'audio-ogg'), $formats)) > 0; -} - -function room_has_music($room) -{ - $formats = get("ROOMS.$room.FORMATS"); - return count(array_intersect(array('music-mp3', 'music-opus', 'music-ogg'), $formats)) > 0; -} - -function room_has_slides($room) -{ - $formats = get("ROOMS.$room.FORMATS"); - return count(array_intersect(array('slides'), $formats)) > 0; -} - -function room_get_possible_selections($room) -{ - $selections = array(); - - if(room_has_hd($room)) $selections[] = 'hd'; - if(room_has_sd($room)) $selections[] = 'sd'; - if(room_has_audio($room)) $selections[] = 'audio'; - if(room_has_music($room)) $selections[] = 'music'; - if(room_has_slides($room)) $selections[] = 'slides'; - - return $selections; -} - -function room_has_rtmp($room) -{ - $formats = get("ROOMS.$room.FORMATS"); - return count(array_intersect(array('rtmp-hd', 'rtmp-sd'), $formats)) > 0; -} - -function room_has_webm($room) -{ - $formats = get("ROOMS.$room.FORMATS"); - return count(array_intersect(array('webm-hd', 'webm-sd'), $formats)) > 0; -} - -function room_has_hls($room) -{ - $formats = get("ROOMS.$room.FORMATS"); - return count(array_intersect(array('hls-hd', 'hls-sd'), $formats)) > 0; -} - -function room_has_irc($room) -{ - return get("ROOMS.$room.IRC") && has("IRC"); -} - -function room_has_twitter($room) -{ - return get("ROOMS.$room.TWITTER") && has("TWITTER"); -} - -function room_has_chat($room) -{ - return room_has_irc($room) || room_has_twitter($room); -} - -function room_get_irc_url($room) -{ - $cfg = get("ROOMS.$room.IRC_CONFIG", get("IRC")); - return sprintf($cfg['URL'], rawurlencode($room)); -} - -function room_get_irc_display($room) -{ - $cfg = get("ROOMS.$room.IRC_CONFIG", get("IRC")); - return sprintf($cfg['DISPLAY'], $room); -} - -function room_get_twitter_hashtag($room) -{ - $cfg = get("ROOMS.$room.TWITTER_CONFIG", get("TWITTER")); - return sprintf($cfg['TEXT'], $room); -} - -function room_get_twitter_display($room) -{ - $cfg = get("ROOMS.$room.TWITTER_CONFIG", get("TWITTER")); - return sprintf($cfg['DISPLAY'], $room); -} - function startswith($needle, $haystack) { return substr($haystack, 0, strlen($needle)) == $needle; } - -function relive_talks() -{ - $talks = @file_get_contents(get('OVERVIEW.RELIVE_JSON')); - $talks = utf8_decode($talks); - $talks = (array)json_decode($talks, true); - - usort($talks, function($a, $b) { - $sort = array('live', 'recorded', 'released'); - return array_search($a['status'], $sort) > array_search($b['status'], $sort); - }); - - $talks_by_id = array(); - foreach ($talks as $value) - { - $talks_by_id[$value['id']] = $value; - } - - return $talks_by_id; -} -- cgit v1.2.3