YSP样例文件增加时长验证功能。

This commit is contained in:
zhangwei
2018-10-16 19:39:55 +08:00
parent 26ff72663c
commit 2bdacc7ba1
7 changed files with 36 additions and 2 deletions

BIN
lib/jave-1.0.2.jar Normal file

Binary file not shown.

View File

@@ -686,4 +686,7 @@ public final class Constants {
// 区域/运营商配置下发时tag值 // 区域/运营商配置下发时tag值
public static final String AREA_TAG=Configurations.getStringProperty("area_tag","location"); public static final String AREA_TAG=Configurations.getStringProperty("area_tag","location");
public static final String ISP_TAG=Configurations.getStringProperty("isp_tag","isp"); public static final String ISP_TAG=Configurations.getStringProperty("isp_tag","isp");
//音视频样例时长限制,单位秒
public static final int AV_DURATION_LIMIT=Configurations.getIntProperty("av_duration_limit", 120);
} }

View File

@@ -38,6 +38,11 @@ import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController; import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils; import com.nis.web.security.UserUtils;
import it.sauronsoftware.jave.AudioInfo;
import it.sauronsoftware.jave.Encoder;
import it.sauronsoftware.jave.MultimediaInfo;
import it.sauronsoftware.jave.VideoInfo;
/** /**
* 处理音视频业务 * 处理音视频业务
* @author zhangwei * @author zhangwei
@@ -157,11 +162,33 @@ public class AvController extends BaseController {
// entity.setSrcMd5(srcMd5); // entity.setSrcMd5(srcMd5);
// entity.setSampleMd5(sampleMd5); // entity.setSampleMd5(sampleMd5);
//验证音视频文件时长
Encoder encoder = new Encoder();
String length = "";
try {
MultimediaInfo m = encoder.getInfo(uploadSrcFile);
long ls = m.getDuration()/1000;
int hour = (int) (ls/3600);
int minute = (int) (ls%3600)/60;
int second = (int) (ls-hour*3600-minute*60);
length = hour+"'"+minute+"''"+second+"'''";
logger.info(uploadSrcFile.getName()+"时长:"+length);
if(ls>0 && second>Constants.AV_DURATION_LIMIT){
addMessage(redirectAttributes,"exceeds_duration_limit");
logger.error("The duration of uploaded files exceeds the limit("+Constants.AV_DURATION_LIMIT+"s).");
return "redirect:" + adminPath +"/ntc/av/sample/fileSampleList?functionId="+entity.getFunctionId();
}
} catch (Exception e) {
e.printStackTrace();
addMessage(redirectAttributes,"save_failed");
return "redirect:" + adminPath +"/ntc/av/sample/fileSampleList?functionId="+entity.getFunctionId();
}
} }
avCfgService.saveOrUpdateAvFileSample(entity, srcFile); avCfgService.saveOrUpdateAvFileSample(entity, srcFile);
addMessage(redirectAttributes,"save_success"); addMessage(redirectAttributes,"save_success");
}catch(Exception e){ }catch(Exception e){
logger.error("文件上传失败",e); logger.error("文件上传失败",e);
e.printStackTrace(); e.printStackTrace();

View File

@@ -1246,3 +1246,4 @@ mail_address_monit=Mail Address Monit
mail_address_reject=Mail Address Reject mail_address_reject=Mail Address Reject
ipsec_protocol=IPSEC Protocol ipsec_protocol=IPSEC Protocol
intercept_intensity=Intercept Related Domains intercept_intensity=Intercept Related Domains
exceeds_duration_limit=File upload failure,The duration of uploaded files exceeds the limit.

View File

@@ -1266,3 +1266,4 @@ mail_address_monit=Mail Address Monit
mail_address_reject=Mail Address Reject mail_address_reject=Mail Address Reject
ipsec_protocol=IPSEC Protocol ipsec_protocol=IPSEC Protocol
intercept_intensity=Intercept Related Domains intercept_intensity=Intercept Related Domains
exceeds_duration_limit=File upload failure,The duration of uploaded files exceeds the limit.

View File

@@ -1240,4 +1240,4 @@ mail_address_monit=\u90AE\u4EF6\u5730\u5740\u76D1\u6D4B
mail_address_reject=\u90AE\u4EF6\u5730\u5740\u7BA1\u63A7 mail_address_reject=\u90AE\u4EF6\u5730\u5740\u7BA1\u63A7
ipsec_protocol=IPSEC\u534F\u8BAE ipsec_protocol=IPSEC\u534F\u8BAE
intercept_intensity=\u62E6\u622A\u5F3A\u5EA6 intercept_intensity=\u62E6\u622A\u5F3A\u5EA6
exceeds_duration_limit=\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25,\u6587\u4EF6\u65F6\u957F\u8D85\u51FA\u9650\u5236.

View File

@@ -528,4 +528,6 @@ log_time_end=2018-10-01 00:00:00
area_tag=location area_tag=location
isp_tag=isp isp_tag=isp
mmFileDigestLog=mmFileDigestLogs mmFileDigestLog=mmFileDigestLogs
ntcStreamMediaLog=ntcStreamMediaLogs ntcStreamMediaLog=ntcStreamMediaLogs
#音视频样例限制时长,单位秒
av_duration_limit=10