增加打印日志

This commit is contained in:
daihh
2023-07-06 17:17:51 +08:00
parent b7085a6b13
commit 00a9eb64a5

View File

@@ -247,11 +247,13 @@ public class CourseFileApi extends ApiBaseController {
}
String fileFullPath = SysConstant.getConfigValue(BaseConstant.CONFIG_UPLOAD_FILES_SAVEPATH) + file.getFilePath();
if ("mp3,mp4".indexOf(file.getFileType()) > -1){
log.info("上传 "+file.getFileType()+"文件:"+file.getFilePath());
Encoder encoder = new Encoder();
try {
//System.out.println(fileFullPath);
MultimediaInfo m = encoder.getInfo(new File(fileFullPath));
Long ls = m.getDuration() / 1000;//秒
log.info("文件时长 "+ls);
//System.out.print("视频时长:" + ls + "秒");
file.setDuration(ls.intValue());
if("mp3".equals(file.getFileType())){// mp3
@@ -260,7 +262,7 @@ public class CourseFileApi extends ApiBaseController {
file.setDecoder(m.getVideo().getDecoder());
file.setVideoHeight(m.getVideo().getSize().getHeight());
file.setVideoWidth(m.getVideo().getSize().getWidth());
log.info("文件的编码 "+file.getDecoder());
if(StringUtils.isBlank(file.getDecoder()) || !file.getDecoder().equals("h264")) {
log.error("编码格式不是h264不能上传");
return error("编码格式不是h264请先转码再上传","");