当前位置: 首页>>代码示例>>PHP>>正文


PHP Stream::find方法代码示例

本文整理汇总了PHP中Stream::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Stream::find方法的具体用法?PHP Stream::find怎么用?PHP Stream::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stream的用法示例。


在下文中一共展示了Stream::find方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index()
 {
     $CRs = new CR($this->db);
     $Actus = new Actu($this->db);
     $Streams = new Stream($this->db);
     $this->f3->set('actus', $Actus->all(10));
     $this->f3->set('streams', $Streams->find(NULL, array('order' => 'twitch_username ASC')));
     $this->f3->set('crs', $CRs->all(10));
     $this->f3->set('site_title', 'Un torrent d\'informations — thetartuffebay.org');
     $this->f3->set('page_head', 'Le premier site d\'information des tartuffes :o');
     $this->f3->set('view', 'home.htm');
 }
开发者ID:XaaT,项目名称:ttb,代码行数:12,代码来源:HomeController.php

示例2: stop_stream

    if (isset($_GET['stop'])) {
        stop_stream($_GET['stop']);
        $message['type'] = "success";
        $message['message'] = "stream stopped";
    }
}
if (isset($_GET['delete'])) {
    $stream = Stream::find($_GET['delete']);
    $stream->delete();
    $message['type'] = "success";
    $message['message'] = "Stream deleted";
}
if (isset($_POST['mass_delete'])) {
    if (isset($_POST['mselect'])) {
        foreach ($_POST['mselect'] as $streamids) {
            $stream = Stream::find($streamids);
            $stream->delete();
        }
    }
    $message['type'] = "success";
    $message['message'] = "Streams deleted";
}
if (isset($_POST['mass_start'])) {
    if (isset($_POST['mselect'])) {
        foreach ($_POST['mselect'] as $streamids) {
            start_stream($streamids);
        }
    }
    $message['type'] = "success";
    $message['message'] = "Streams started";
}
开发者ID:addonBrasil,项目名称:FOS-Streaming-v1,代码行数:31,代码来源:streams.php

示例3: start_stream

function start_stream($id)
{
    $stream = Stream::find($id);
    $setting = Setting::first();
    if ($stream->restream) {
        $stream->checker = 0;
        $stream->pid = null;
        $stream->running = 1;
        $stream->status = 1;
    } else {
        $stream->checker = 0;
        $checkstreamurl = shell_exec('' . $setting->ffprobe_path . ' -analyzeduration 1000000 -probesize 9000000 -i "' . $stream->streamurl . '" -v  quiet -print_format json -show_streams 2>&1');
        $streaminfo = json_decode($checkstreamurl, true);
        if ($streaminfo) {
            $pid = shell_exec(getTranscode($stream->id));
            $stream->pid = $pid;
            $stream->running = 1;
            $stream->status = 1;
            $video = "";
            $audio = "";
            if (is_array($streaminfo)) {
                foreach ($streaminfo['streams'] as $info) {
                    if ($video == '') {
                        $video = $info['codec_type'] == 'video' ? $info['codec_name'] : '';
                    }
                    if ($audio == '') {
                        $audio = $info['codec_type'] == 'audio' ? $info['codec_name'] : '';
                    }
                }
                $stream->video_codec_name = $video;
                $stream->audio_codec_name = $audio;
            }
        } else {
            $stream->running = 1;
            $stream->status = 2;
            //TODO: need to make recursive
            if (checkPid($stream->pid)) {
                shell_exec("kill -9 " . $stream->pid);
                shell_exec("/bin/rm -r /home/fos-streaming/fos/www/" . $setting->hlsfolder . "/" . $stream->id . "*");
            }
            if ($stream->streamurl2) {
                $stream->checker = 2;
                $checkstreamurl = shell_exec('' . $setting->ffprobe_path . ' -analyzeduration 1000000 -probesize 9000000 -i "' . $stream->streamurl . '" -v  quiet -print_format json -show_streams 2>&1');
                $streaminfo = json_decode($checkstreamurl, true);
                if ($streaminfo) {
                    $pid = shell_exec(getTranscode($stream->id, 2));
                    $stream->pid = $pid;
                    $stream->running = 1;
                    $stream->status = 1;
                    $video = "";
                    $audio = "";
                    if (is_array($streaminfo)) {
                        foreach ($streaminfo['streams'] as $info) {
                            if ($video == '') {
                                $video = $info['codec_type'] == 'video' ? $info['codec_name'] : '';
                            }
                            if ($audio == '') {
                                $audio = $info['codec_type'] == 'audio' ? $info['codec_name'] : '';
                            }
                        }
                        $stream->video_codec_name = $video;
                        $stream->audio_codec_name = $audio;
                    }
                } else {
                    $stream->running = 1;
                    $stream->status = 2;
                    if (checkPid($stream->pid)) {
                        shell_exec("kill -9 " . $stream->pid);
                        shell_exec("/bin/rm -r /home/fos-streaming/fos/www/" . $setting->hlsfolder . "/" . $stream->id . "*");
                    }
                    //streamurl 3 checker
                    if ($stream->streamurl3) {
                        $stream->checker = 3;
                        $checkstreamurl = shell_exec('' . $setting->ffprobe_path . ' -analyzeduration 1000000 -probesize 9000000 -i "' . $stream->streamurl . '" -v  quiet -print_format json -show_streams 2>&1');
                        $streaminfo = json_decode($checkstreamurl, true);
                        if ($streaminfo) {
                            $pid = shell_exec(getTranscode($stream->id, 3));
                            $stream->pid = $pid;
                            $stream->running = 1;
                            $stream->status = 1;
                            $video = "";
                            $audio = "";
                            if (is_array($streaminfo)) {
                                foreach ($streaminfo['streams'] as $info) {
                                    if ($video == '') {
                                        $video = $info['codec_type'] == 'video' ? $info['codec_name'] : '';
                                    }
                                    if ($audio == '') {
                                        $audio = $info['codec_type'] == 'audio' ? $info['codec_name'] : '';
                                    }
                                }
                                $stream->video_codec_name = $video;
                                $stream->audio_codec_name = $audio;
                            }
                        } else {
                            $stream->running = 1;
                            $stream->status = 2;
                            $stream->pid = null;
                        }
                    }
//.........这里部分代码省略.........
开发者ID:sarelmx,项目名称:FOS-Streaming-v1,代码行数:101,代码来源:_functions.php

示例4: header

    $error = "Username or Password is invalid";
    header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
    header('Status: 404 Not Found');
    die;
}
$user = User::where('username', '=', $username)->where('password', '=', $password)->where('active', '=', 1)->first();
if (!isset($_SESSION['user_id'])) {
    // TODO: secret key
    $token = !$user ? die : uniqid();
}
if ($user->exp_date != "0000-00-00") {
    if ($user->exp_date <= Carbon::today()) {
        die;
    }
}
$stream = Stream::find($id);
if (!isset($_SESSION['user_id'])) {
    !$stream ? die : "";
}
$stream->status != 1 ? die : "";
ob_end_clean();
ob_start();
ignore_user_abort(true);
$user->lastconnected_ip = $ip;
$user->last_stream = $stream->id;
$user->useragent = $_SERVER['HTTP_USER_AGENT'];
$user->save();
$url = $stream->streamurl;
if ($stream->checker == 2) {
    $url = $stream->streamurl2;
}
开发者ID:Nemeziz,项目名称:FOS-Streaming,代码行数:31,代码来源:stream.php

示例5: logincheck

<?php

include 'config.php';
logincheck();
$setting = Setting::first();
$stream = Stream::find($_GET['id']);
$streamurl = $setting->hlsfolder . "/" . $stream->id . "_.m3u8";
echo $template->view()->make('play')->with('streamurl', $streamurl)->render();
开发者ID:addonBrasil,项目名称:FOS-Streaming-v1,代码行数:8,代码来源:play.php

示例6: index

 public function index()
 {
     $Streams = new Stream($this->db);
     $this->f3->set('streams', $Streams->find(NULL, array('order' => 'twitch_username ASC')));
     $this->f3->set('view', 'stream/list.htm');
 }
开发者ID:XaaT,项目名称:ttb,代码行数:6,代码来源:StreamController.php

示例7: start_stream

function start_stream($id)
{
    $stream = Stream::find($id);
    $setting = Setting::first();
    $stream->checker = 0;
    $checkstreamurl = shell_exec('/usr/bin/timeout 15s ' . $setting->ffprobe_path . ' -analyzeduration 10000000 -probesize 9000000 -i "' . $stream->streamurl . '" -v  quiet -print_format json -show_streams 2>&1');
    $streaminfo = (array) json_decode($checkstreamurl);
    if (count($streaminfo) > 0) {
        $pid = shell_exec(getTranscode($stream->id));
        $stream->pid = $pid;
        $stream->running = 1;
        $stream->status = 1;
        if (isset($streaminfo->streams)) {
            foreach ((array) $streaminfo->streams as $info) {
                if ($info->codec_type == 'video') {
                    $stream->video_codec_name = $info->codec_long_name;
                } else {
                    if ($info->codec_type == 'audio') {
                        $stream->audio_codec_name = $info->codec_long_name;
                    }
                }
            }
        }
    } else {
        $stream->running = 1;
        $stream->status = 2;
        //need to make recursive
        ////streamurl 2 checker
        shell_exec("kill -9 " . $stream->pid);
        shell_exec("/bin/rm -r /usr/local/nginx/html/" . $setting->hlsfolder . "/" . $stream->id . "*");
        if ($stream->streamurl2) {
            $stream->checker = 2;
            echo "checking stream 2";
            $checkstreamurl = shell_exec('/usr/bin/timeout 15s ' . $setting->ffprobe_path . ' -analyzeduration 10000000 -probesize 9000000 -i "' . $stream->streamurl2 . '" -v  quiet -print_format json -show_streams 2>&1');
            $streaminfo = (array) json_decode($checkstreamurl);
            if (count($streaminfo) > 0) {
                echo getTranscode($stream->id, 2);
                $pid = shell_exec(getTranscode($stream->id, 2));
                $stream->pid = $pid;
                $stream->running = 1;
                $stream->status = 1;
                if (isset($streaminfo->streams)) {
                    foreach ((array) $streaminfo->streams as $info) {
                        if ($info->codec_type == 'video') {
                            $stream->video_codec_name = $info->codec_long_name;
                        } else {
                            if ($info->codec_type == 'audio') {
                                $stream->audio_codec_name = $info->codec_long_name;
                            }
                        }
                    }
                }
            } else {
                $stream->running = 1;
                $stream->status = 2;
                shell_exec("kill -9 " . $stream->pid);
                shell_exec("/bin/rm -r /usr/local/nginx/html/" . $setting->hlsfolder . "/" . $stream->id . "*");
                //streamurl 3 checker
                if ($stream->streamurl3) {
                    $stream->checker = 3;
                    $checkstreamurl = shell_exec('/usr/bin/timeout 15s ' . $setting->ffprobe_path . ' -analyzeduration 10000000 -probesize 9000000 -i "' . $stream->streamurl3 . '" -v  quiet -print_format json -show_streams 2>&1');
                    $streaminfo = (array) json_decode($checkstreamurl);
                    if (count($streaminfo) > 0) {
                        $pid = shell_exec(getTranscode($stream->id, 3));
                        $stream->pid = $pid;
                        $stream->running = 1;
                        $stream->status = 1;
                        if (isset($streaminfo->streams)) {
                            foreach ((array) $streaminfo->streams as $info) {
                                if ($info->codec_type == 'video') {
                                    $stream->video_codec_name = $info->codec_long_name;
                                } else {
                                    if ($info->codec_type == 'audio') {
                                        $stream->audio_codec_name = $info->codec_long_name;
                                    }
                                }
                            }
                        }
                    } else {
                        $stream->running = 1;
                        $stream->status = 2;
                        $stream->pid = null;
                    }
                }
            }
        }
    }
    $stream->save();
}
开发者ID:grimelinse,项目名称:FOS-Streaming,代码行数:89,代码来源:_functions.php


注:本文中的Stream::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。