@@ -151,7 +151,7 @@ public class EtlServiceImpl implements EtlService {
// 保存数据库(去重校验)
id = save2db(crawlerVideo);
if (id <= 0) {
- throw new CommonException(ExceptionEnum.DATA_ERROR, "save2db failed.");
+ throw new CommonException(ExceptionEnum.DATA_ERROR, "save2db failed, duplicated out video id.");
}
// 策略应用
@@ -459,7 +459,7 @@ public class EtlServiceImpl implements EtlService {
log.error("the operation '{}' has failed on the {}th retry.", errorMsg, retry, e);
if (retry >= retryTimes) {
throw new CommonException(ExceptionEnum.SYSTEM_ERROR,
- "the operation '" + errorMsg + "' has failed after " + retry + " times retry.");
+ "the operation '" + errorMsg + "' has failed after " + retry + " times retry. 'cause of [" + e.getMessage() + "]");
@@ -24,6 +24,8 @@
package com.tzld.crawler.etl.util;
+import com.tzld.crawler.etl.common.enums.ExceptionEnum;
+import com.tzld.crawler.etl.common.exception.CommonException;
import com.tzld.crawler.etl.model.dto.VideoInfoDto;
import net.bramp.ffmpeg.FFprobe;
import net.bramp.ffmpeg.probe.FFmpegProbeResult;
@@ -31,6 +33,7 @@ import net.bramp.ffmpeg.probe.FFmpegStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.File;
import java.util.List;
/**
@@ -86,6 +89,10 @@ public class VideoUtils {
"-c:v", "copy", "-c:a", "aac", "-strict", "experimental", "-map", "0:v:0", "-map", "1:a:0", outPath);
Process process = processBuilder.start();
process.waitFor();
+
+ if (!new File(outPath).exists()) {
+ throw new CommonException(ExceptionEnum.DATA_ERROR, "video synthesis failed, No synthesized video file output.");
+ }
// } catch (Exception e) {
// log.error("video {} audio {} synthesis error.", videoPath, audioPath, e);
// throw new CommonException(ExceptionEnum.DATA_ERROR, "video synthesis error");