コード例 #1
0
ファイル: record.php プロジェクト: h3len/Project
if (!$starttime || !$endtime || $endtime < $starttime) {
    error_output('002', '时间设置错误');
}
if (time() - $starttime > $save_time * 3600) {
    error_output('003', '直播节目已不存在,无法获取');
}
if ($endtime - $starttime > 86400) {
    error_output('004', '时间设置过长');
}
$endtime = $endtime + 5;
if ($endtime > time()) {
    error_output('005', date('Y-m-d H:i:s', $endtime) . '节目尚未结束,请' . date('Y-m-d H:i:s', time()) . '开始');
}
$filetype = '.flv';
if (!$_INPUT['vodid']) {
    $last_id = hg_get_video_id();
    $a = 'create';
} else {
    $last_id = $_INPUT['vodid'];
}
$video_dir = hg_num2dir($last_id);
if (!hg_mkdir(UPLOAD_DIR . $video_dir) || !is_writeable(UPLOAD_DIR . $video_dir)) {
    error_output('004', UPLOAD_DIR . '目录不可写入文件');
}
$targerdir = TARGET_DIR . $video_dir . $last_id . '.ssm/';
hg_mkdir($targerdir);
$filepath = $video_dir . $last_id . $filetype;
if (!$_INPUT['id'] && $last_id && $gVodApi['host'] && $a) {
    $vod = array('vodid' => $last_id, 'totalsize' => $filesize, 'type' => $filetype, 'source' => $channel_id, 'starttime' => $starttime, 'delay_time' => $_INPUT['delay_time'], 'vod_sort_id' => $vod_sort_id, 'title' => $program, 'vod_leixing' => 3, 'admin_id' => $_INPUT['admin_id'], 'admin_name' => $_INPUT['admin_name'] ? $_INPUT['admin_name'] : '自动录制');
    include_once ROOT_DIR . 'lib/curl.class.php';
    $curl = new curl($gVodApi['host'], $gVodApi['dir'] . 'admin/', $gVodApi['token']);
コード例 #2
0
ファイル: save_section.php プロジェクト: h3len/Project
}
if (count($svodid) != count($start) || count($svodid) != count($duration)) {
    error_output('003', '视频信息不匹配');
}
include ROOT_DIR . 'lib/mediainfo.class.php';
$mediainfo = new mediainfo();
$source = array();
foreach ($svodid as $k => $sid) {
    $video_dir = hg_num2dir($sid);
    $targerdir = TARGET_DIR . $video_dir . $sid . '.ssm/';
    $mp4 = $targerdir . $sid . '.mp4';
    $mediainfo->setFile($mp4);
    $data = $mediainfo->getMeidaInfo();
    $source[] = array('source' => $mp4, 'start' => intval($start[$k]), 'duration' => intval($duration[$k]), 'mediainfo' => $data);
}
$file_id = $_INPUT['vodid'];
if (!$file_id) {
    $file_id = hg_get_video_id();
}
$dir = hg_num2dir($file_id);
$video_dir = hg_num2dir($file_id);
$targerdir = TARGET_DIR . $video_dir . $file_id . '.ssm/';
hg_mkdir($targerdir);
$curl = new curl($gVodApi['host'], $gVodApi['dir'], $gVodApi['token']);
$curl->initPostData();
$conf = $curl->request('vod_config.php');
$gTransApi['filename'] = 'getVideoInfo.php';
$trans_info = array('sourceFile' => $source, 'id' => $video_id, 'vodid' => $file_id, 'targetDir' => $targerdir, 'config' => $conf[0], 'callback' => $gTransApi);
hg_file_write(UPLOAD_DIR . FILE_QUEUE . $file_id, json_encode($trans_info));
$data = array('vodid' => $file_id, 'cmd' => $cmd, 'trans_info' => $trans_info, 'target' => $targerdir);
output($data);