Commit a3f8d16b1f3cf1706be1a839d112b091e84b5a5a

Authored by 郑超
1 parent 64031a8f

update

src/main/java/com/cnlive/shenhe/api/VideosControllerApi.java
@@ -25,7 +25,7 @@ import java.util.List; @@ -25,7 +25,7 @@ import java.util.List;
25 import java.util.Map; 25 import java.util.Map;
26 26
27 /** 27 /**
28 - * @Auther: chenhao 28 + * @author : chenhao
29 * @Date: 2018/12/6 11:17 29 * @Date: 2018/12/6 11:17
30 * @Description: 视频送审接口 30 * @Description: 视频送审接口
31 */ 31 */
@@ -80,6 +80,7 @@ public class VideosControllerApi { @@ -80,6 +80,7 @@ public class VideosControllerApi {
80 shyVideos1.setVideo_id(videoId); 80 shyVideos1.setVideo_id(videoId);
81 List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos1); 81 List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos1);
82 if (shyVideosList.size() > 0) { 82 if (shyVideosList.size() > 0) {
  83 + logger.info("点播入库更新视频开始............................");
83 ShyVideos shyVideos = shyVideosList.get(0); 84 ShyVideos shyVideos = shyVideosList.get(0);
84 //封装数据入库 85 //封装数据入库
85 shyVideos.setVideo_id(videoId); 86 shyVideos.setVideo_id(videoId);
@@ -137,6 +138,7 @@ public class VideosControllerApi { @@ -137,6 +138,7 @@ public class VideosControllerApi {
137 */ 138 */
138 private ResponseBean saveVideo(JSONObject json, ShyVideos shyVideos1, String source, Integer duration, String category, String sid) { 139 private ResponseBean saveVideo(JSONObject json, ShyVideos shyVideos1, String source, Integer duration, String category, String sid) {
139 //查了,没有,直接插入数据库 140 //查了,没有,直接插入数据库
  141 + logger.info("点播入库保存视频开始............................");
140 shyVideos1.setSource(source); 142 shyVideos1.setSource(source);
141 shyVideos1.setVideo_title(json.getString("videoTitle")); 143 shyVideos1.setVideo_title(json.getString("videoTitle"));
142 shyVideos1.setVideo_url(json.getString("videoUrl")); 144 shyVideos1.setVideo_url(json.getString("videoUrl"));
@@ -162,19 +164,27 @@ public class VideosControllerApi { @@ -162,19 +164,27 @@ public class VideosControllerApi {
162 shyVideos1.setBucket(json.getString("bucketName")); 164 shyVideos1.setBucket(json.getString("bucketName"));
163 shyVideos1.setPlat(json.getInteger("bucketType")); 165 shyVideos1.setPlat(json.getInteger("bucketType"));
164 shyVideos1.setDuration(duration); 166 shyVideos1.setDuration(duration);
165 - shyVideos1.setCategory(category);//传入栏目分类  
166 - shyVideos1.setVideo_user_id(sid);//传入sid  
167 - videosService.getShenheType(shyVideos1);//获取审核类型 167 + //传入栏目分类
  168 + shyVideos1.setCategory(category);
  169 + //传入sid
  170 + shyVideos1.setVideo_user_id(sid);
  171 + //获取审核类型
  172 + videosService.getShenheType(shyVideos1);
168 173
169 if (shyVideos1.getShenhe_type() != 1) { 174 if (shyVideos1.getShenhe_type() != 1) {
170 - if (shyVideos1.getShenhe_type() == CommonConst.AUDIT_TYPE_USER) {//如果审核类型是人工审核,按照原有规则 175 + //如果审核类型是人工审核,按照原有规则
  176 + if (shyVideos1.getShenhe_type() == CommonConst.AUDIT_TYPE_USER) {
171 if (CommonUtils.isNotNull(duration) && duration > 80) { 177 if (CommonUtils.isNotNull(duration) && duration > 80) {
172 - shyVideos1 = avsample(shyVideos1);//视频至少可以抽8张,请求抽帧 178 + //视频至少可以抽8张,请求抽帧
  179 + shyVideos1 = avsample(shyVideos1);
173 } 180 }
174 - } else if (shyVideos1.getShenhe_type() == CommonConst.AUDIT_TYPE_MACHANE) {//如果审核类型是机审  
175 - if (CommonUtils.isNotNull(duration) && duration < 60) {//"目击者"视频,小于60秒的抽帧 181 + //如果审核类型是机审
  182 + } else if (shyVideos1.getShenhe_type() == CommonConst.AUDIT_TYPE_MACHANE) {
  183 + //"目击者"视频,小于60秒的抽帧
  184 + if (CommonUtils.isNotNull(duration) && duration < 60) {
176 shyVideos1 = avsample(shyVideos1); 185 shyVideos1 = avsample(shyVideos1);
177 - } else {//机审超过60秒的改为人工审核 186 + } else {
  187 + //机审超过60秒的改为人工审核
178 shyVideos1.setShenhe_type(3); 188 shyVideos1.setShenhe_type(3);
179 } 189 }
180 } 190 }
@@ -211,32 +221,36 @@ public class VideosControllerApi { @@ -211,32 +221,36 @@ public class VideosControllerApi {
211 JSONObject attach = new JSONObject(); 221 JSONObject attach = new JSONObject();
212 JSONObject extParam = new JSONObject(); 222 JSONObject extParam = new JSONObject();
213 223
214 - if (!video.getCategory().equals(CommonConst.CATEGORY_WITNESS)) {//非“目击者”视频  
215 - Integer interval = 10;//默认抽帧时长  
216 - interval = video.getDuration() / 3600 * 10 + 10;//抽帧时长的算法:视频时长每增加一小时,抽帧时长增加10秒 224 + //非“目击者”视频
  225 + if (!video.getCategory().equals(CommonConst.CATEGORY_WITNESS)) {
  226 + //默认抽帧时长
  227 + Integer interval = 10;
  228 + //抽帧时长的算法:视频时长每增加一小时,抽帧时长增加10秒
  229 + interval = video.getDuration() / 3600 * 10 + 10;
217 attach.put("interval", interval); 230 attach.put("interval", interval);
218 attach.put("strategy", 1); 231 attach.put("strategy", 1);
219 attach.put("duration", video.getDuration()); 232 attach.put("duration", video.getDuration());
220 } else { 233 } else {
221 - if (video.getDuration() > 4) {//“目击者”视频时间大于4秒  
222 - attach.put("interval", 4);//间隔 单位s  
223 - attach.put("num", video.getDuration() / 4);//覆盖转码服务的默认抽帧图数量 234 + //“目击者”视频时间大于4秒
  235 + if (video.getDuration() > 4) {
  236 + //间隔 单位s
  237 + attach.put("interval", 4);
  238 + //覆盖转码服务的默认抽帧图数量
  239 + attach.put("num", video.getDuration() / 4);
224 attach.put("duration", video.getDuration()); 240 attach.put("duration", video.getDuration());
225 -// attach.put("strategy", 1);//是否从头抽到尾(1:是,优先级大于num)  
226 } else { 241 } else {
227 - attach.put("num", 1);//抽帧图片张数  
228 - attach.put("first", 0);//是否首帧,0:是。num=1时有效 242 + //抽帧图片张数
  243 + attach.put("num", 1);
  244 + //是否首帧,0:是。num=1时有效
  245 + attach.put("first", 0);
229 } 246 }
230 } 247 }
231 -  
232 -  
233 logger.info("抽帧attach参数:attach:{}", attach); 248 logger.info("抽帧attach参数:attach:{}", attach);
234 extParam.put("domain", domian); 249 extParam.put("domain", domian);
235 if (CommonConst.KS_PLAT == plat) { 250 if (CommonConst.KS_PLAT == plat) {
236 //金山 251 //金山
237 params.put("plat", 0); 252 params.put("plat", 0);
238 params.put("dstBucket", ks_bucket); 253 params.put("dstBucket", ks_bucket);
239 -  
240 } else if (CommonConst.QINIU_PLAT == plat) { 254 } else if (CommonConst.QINIU_PLAT == plat) {
241 //七牛 255 //七牛
242 params.put("plat", 1); 256 params.put("plat", 1);