视频样式转关键帧图片过程增加返回参数验证。

This commit is contained in:
zhangwei
2018-10-25 17:29:49 +08:00
parent 77446728ea
commit f2d013ec70
2 changed files with 71 additions and 45 deletions

View File

@@ -15,6 +15,9 @@ import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.io.filefilter.IOFileFilter;
import org.apache.tools.zip.ZipOutputStream;
import org.springframework.mock.web.MockMultipartFile;
@@ -557,12 +560,32 @@ public class AvController extends BaseController {
String shellName = Constants.VEDIO_TO_PICTURE_PROC;
// String params = srcFileAllPath+" "+picFilePath+" 0.95 90.0 0.5";
String params = srcFileAllPath+" "+picFilePath;
logger.info("调用视频转关键帧图片程序输入参数:"+params);
Map resultMap = avCfgService.execShell(shellName, params);
if(resultMap.get("exitStatus").equals(0)){//调用外部程序成功
//关键帧图片生成成功,删除原视频文件
FileUtils.deleteFile(srcFileAllPath);
map.put("status", 1);
map.put("msg", "success");
String out = resultMap.get("out").toString();//输出参数
JSONArray resArray =JSONArray.fromObject(out);
JSONObject resObject = resArray.getJSONObject(0);
logger.info("调用视频转关键帧图片程序输出参数:"+resObject);
int state = resObject.getInt("state");
if(state==1){
//关键帧图片生成成功,删除原视频文件
FileUtils.deleteFile(srcFileAllPath);
map.put("status", 1);
map.put("msg", "success");
}else{
if(StringUtil.isEmpty(resObject.getString("message"))){
map.put("status", 0);
map.put("msg", getMsgProp().getProperty("call_external_procedures_failed", "Call external procedures failed"));
}else{
map.put("status", 0);
map.put("msg", resObject.getString("message"));
}
}
}else{
map.put("status", 0);
map.put("msg", getMsgProp().getProperty("call_external_procedures_failed", "Call external procedures failed"));
}
}else{
map.put("status", 0);