Commit d85ba641 by 冷斌

fix bug

parent 2fdbb21f
......@@ -15,6 +15,8 @@ class Progress
{
// 进度报告地址
$log_file = $new_file.'.log';
var_dump($log_file);
die;
if(is_file($log_file)){
$log = file_get_contents($log_file);
// 从报告中检测是否存在处理完成字段
......@@ -26,7 +28,7 @@ class Progress
if($match[1]){
$haddleTime = [end($match[1])];
}
}else{
// 从命令中获取
if (IS_WIN) {
......@@ -58,7 +60,7 @@ class Progress
$cmd = 'PATH=$PATH' . " ffmpeg -i " . $old_file . " 2>&1 | grep 'Duration' | cut -d ' ' -f 4 | sed s/,//";
exec($cmd, $totalTime);
}
$totalTime = explode(":", $totalTime[0]);
$totalTime_ss = $totalTime[0] * 3600 + $totalTime[1] * 60 + round($totalTime[2]); //转化为秒
$haddleTime = explode(":", $haddleTime[0]);
......@@ -68,7 +70,7 @@ class Progress
}else{
$progress = ($haddleTime_ss / $totalTime_ss) * 100;
}
// 允许存在写入时间误差趋于1.
return $progress >= 99 ? 100 : $progress;
}
......
......@@ -9,8 +9,6 @@ class ToMp4
{
public function fire(Job $obj, $data)
{
var_dump($obj, $data);
die;
if (!is_file($data['file'])) {
// 删除本次任务
$obj->delete();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment