增加打印日志

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