/step_one.php
https://bitbucket.org/santafear/converted · PHP · 102 lines · 63 code · 17 blank · 22 comment · 7 complexity · 6cb010ec4c9656367667dde5fef4ed79 MD5 · raw file
- <?php
- //exemple php /var/www/webroot/converter/step_one.php /home/chroot/user1/home/user1/2 1 2
- //exemple php /usr/local/converter/step_one.php /home/katanyou/2 1 2
- //exemple php /var/converted/step_one.php /home/katanyou/2 1 2 (in 61.47.40.194)
- //https://studio.ving.tv/api/wowza/getftppath
- //https://studio.ving.tv/api/wowza/getftppathads/
- //https://studio.ving.tv/api/wowza/getpathads/
- $folderpath = $argv[1];
- $partner_id = $argv[2];
- $channel_id = $argv[3];
- $ftp_name = "";
- $file_src = "";
- $file_desc = "";
- if ($handle = opendir($folderpath)) {
- while (false !== ($file = readdir($handle))) {
- //echo $file."\n";
- if ($file[0] == ".") {
- continue;
- }
- $ch = curl_init('https://studiov1.ving.tv/api/wowza/createvideo/partner_id/' . $partner_id . '/tv_channel_id/' . $channel_id . '/name/' . basename($file));
- // $ch = curl_init('https://studio.ving.tv/api/wowza/createvideo/partner_id/' . $partner_id . '/tv_channel_id/' . $channel_id . '/name/' . basename($file));
- // echo 'https://v1.studio.ving.tv/api/wowza/createvideo/partner_id/'. $partner_id .'/tv_channel_id/'. $channel_id .'/name/'. basename($file).'/ftp_name/'.$ftp_name;
- echo 'https://studiov1.ving.tv/api/wowza/createvideo/partner_id/'. $partner_id .'/tv_channel_id/'. $channel_id .'/name/'. basename($file);
- // $ch = curl_init('https://studio.ving.tv/api/wowza/createvideo/partner_id/'. $partner_id .'/tv_channel_id/'. $channel_id .'/name/'. basename($file).'/ftp_name/'.$ftp_name);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_VERBOSE, 0);
- $json = curl_exec($ch);
- print curl_error($ch);
- print curl_errno($ch);
- curl_close($ch);
- $json = trimJson($json);
- $data = json_decode($json);
-
- $file_src = null;
- for($i = 0; $i<count($data); $i++) {
- $status = $data[$i]->status;
- $convert_status = $data[$i]->convert_status;
- $is_trailer = $data[$i]->is_trailer;
- $partner_vdo_id = $data[$i]->partner_vdo_id;
- $file_name = $data[$i]->file_name;
- $path_name = $data[$i]->path_name;
- $file_type = $data[$i]->file_type;
- $width = $data[$i]->width;
- $height = $data[$i]->height;
- $bitrate = $data[$i]->bitrate;
- $id = $data[$i]->id;
- $length = $data[$i]->length;
- $order_no = $data[$i]->order_no;
- $path_form = $data[$i]->path_form;
- $path_to = $data[$i]->path_to;
- //echo "#######====###### status:".$status.", convert_status:" .$convert_status.",is_trailer:".$is_trailer.",partner_vdo_id:".$partner_vdo_id.",file_name:".$file_name.",path_name:".$path_name.",file_type".$file_type.",id:".$id;
-
- $file_src = $path_form;
- $file_desc = $path_to . "." . $file_type . "." . $partner_id . "." . $channel_id.".".$id.".".$partner_vdo_id;
- if (file_exists($file_src)) {
- if (copy($file_src, $file_desc)) {
- echo "unlink($file_src);\n";
- //unlink($file_src);
- /*$ffmpegInstance = new ffmpeg_movie($file_desc);
- $length = date('H:i:s', mktime(0, 0, (int) $ffmpegInstance->getDuration(), 0, 0, 0));
- $ffmpegInstance->getDuration();
- $ffmpegInstance->getFrameCount();
- $ffmpegInstance->getFrameRate();
- $ffmpegInstance->getFilename();
- $height = $ffmpegInstance->getFrameHeight();
- $width = $ffmpegInstance->getFrameWidth();
- $bitrate = $ffmpegInstance->getBitRate() / 1000;
- $filetype = $ffmpegInstance->getVideoCodec();*/
- echo 'https://studiov1.ving.tv/api/wowza/updatevideo/id/' . $id . '/status/q';
- $ch = curl_init('https://studiov1.ving.tv/api/wowza/updatevideo/id/' . $id . '/status/q');
- echo $rec_data = curl_exec($ch);
- curl_close($ch);
-
- }
- }//end if (file_exists($file_src))
- }
- echo "unlink($file_src);\n";
- unlink($file_src);
- }
- closedir($handle);
- }
- exit();
- function trimJson($str) {
- $pos = strpos($str, "[");
- return substr($str, $pos);
- }
- ?>