视频样式转关键帧图片过程增加返回参数验证。
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -47,47 +47,50 @@ $(function(){
|
||||
});
|
||||
|
||||
$("#srcFile").on('change',function(){
|
||||
sampleFileValidate(fileType,$("#srcFile").val());
|
||||
$("#srcFileInfo").val($("#srcFile").val());
|
||||
var videoToPicture = $("#videoToPicture").val();
|
||||
if(videoToPicture=="true"){
|
||||
if(sampleFileValidate(fileType,$("#srcFile").val())){
|
||||
//样例文件类型正确进行后续处理
|
||||
$("#srcFileInfo").val($("#srcFile").val());
|
||||
var videoToPicture = $("#videoToPicture").val();
|
||||
if(videoToPicture=="true"){
|
||||
|
||||
var fd = new FormData($('#cfgFrom')[0]);
|
||||
$.ajax({
|
||||
url: "${ctx}/ntc/av/sample/videoToPicture",
|
||||
type: "POST",
|
||||
processData: false,
|
||||
contentType: false,
|
||||
data: fd,
|
||||
async: true,
|
||||
cache: false,
|
||||
beforeSend: function(){
|
||||
loading('onloading...');
|
||||
},
|
||||
success: function(data) {
|
||||
top.$.jBox.closeTip();
|
||||
if(data.status==1){
|
||||
$("#picPath").val(data.picFilePath);
|
||||
$("#showPicture").removeClass("hidden");
|
||||
var url = "${ctx}/ntc/av/sample/selectVedioPicture?picFilePath="+encodeURIComponent(data.picFilePath);
|
||||
$.jBox("iframe:"+url, {
|
||||
title: "",
|
||||
width: 1350,
|
||||
height:800,
|
||||
dragLimit: true,
|
||||
buttons: { 'close': true,"ok":"ok" }
|
||||
});
|
||||
}else{
|
||||
alert(data.msg);
|
||||
}
|
||||
var fd = new FormData($('#cfgFrom')[0]);
|
||||
$.ajax({
|
||||
url: "${ctx}/ntc/av/sample/videoToPicture",
|
||||
type: "POST",
|
||||
processData: false,
|
||||
contentType: false,
|
||||
data: fd,
|
||||
async: true,
|
||||
cache: false,
|
||||
beforeSend: function(){
|
||||
loading('onloading...');
|
||||
},
|
||||
success: function(data) {
|
||||
top.$.jBox.closeTip();
|
||||
if(data.status==1){
|
||||
$("#picPath").val(data.picFilePath);
|
||||
$("#showPicture").removeClass("hidden");
|
||||
var url = "${ctx}/ntc/av/sample/selectVedioPicture?picFilePath="+encodeURIComponent(data.picFilePath);
|
||||
$.jBox("iframe:"+url, {
|
||||
title: "",
|
||||
top: '1%',
|
||||
draggable:false,
|
||||
width: 1000,
|
||||
height:500,
|
||||
buttons: { 'close': true }
|
||||
});
|
||||
}else{
|
||||
alert(data.msg);
|
||||
}
|
||||
|
||||
},
|
||||
error:function(jqXHR, textStatus, errorThrown){
|
||||
top.$.jBox.closeTip();
|
||||
alert(errorThrown);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
error:function(jqXHR, textStatus, errorThrown){
|
||||
top.$.jBox.closeTip();
|
||||
alert(errorThrown);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
/* $("#uploadSample,#sampleFileInfo").on('click',function(){
|
||||
|
||||
Reference in New Issue
Block a user