|
|
@@ -64,34 +64,26 @@ public class VideoPostServiceImpl implements VideoPostService {
|
|
|
this.videoCategoryPostMapper = videoCategoryPostMapper;
|
|
|
}
|
|
|
|
|
|
- public Result publishVideoFile(VideoFilePublish videoFilePublish) {
|
|
|
+ public String publishVideoFile(VideoFilePublish videoFilePublish) throws Exception {
|
|
|
String title = videoFilePublish.getFilename();
|
|
|
String videoFileId = videoFilePublish.getVideoFileId();
|
|
|
int channelCode = videoFilePublish.getChannelCode();
|
|
|
- Result result;
|
|
|
- try {
|
|
|
- VideoInfo videoInfo = ossService.getVideoInfo(channelCode, videoFileId);
|
|
|
- if (!videoInfo.getFormatName().contains("mov,mp4")) {
|
|
|
- long jobId = jobService.addConvertVideoJob(videoFileId, channelCode);
|
|
|
+ VideoInfo videoInfo = ossService.getVideoInfo(channelCode, videoFileId);
|
|
|
+ if (!videoInfo.getFormatName().contains("mov,mp4")) {
|
|
|
+ long jobId = jobService.addConvertVideoJob(videoFileId, channelCode);
|
|
|
/*Result result1 = fileService.convertVideo(videoFileId, channelCode);
|
|
|
if (result1.getCode() == ResultStatus.SUCCESS.getCode()) {
|
|
|
videoPost.setStatus(VideoStatus.converted.getCode());
|
|
|
} else {
|
|
|
log.error(result1.getMsg());
|
|
|
}*/
|
|
|
- }
|
|
|
-
|
|
|
- String videoId = idGenerator.getUuid();
|
|
|
- VideoFile videoFile = new VideoFile(videoId, videoInfo, channelCode);
|
|
|
- VideoPost videoPost = new VideoPost(videoId, title, videoFile);
|
|
|
- videoRepository.saveVideo(videoFile, videoPost);
|
|
|
- result = Result.success(videoId);
|
|
|
- } catch (Exception e) {
|
|
|
- String errMsg = String.format("视频文件 %s 在 oss 中不存在", videoFileId);
|
|
|
- result = Result.fail(errMsg);
|
|
|
}
|
|
|
|
|
|
- return result;
|
|
|
+ String videoId = idGenerator.getUuid();
|
|
|
+ VideoFile videoFile = new VideoFile(videoId, videoInfo, channelCode);
|
|
|
+ VideoPost videoPost = new VideoPost(videoId, title, videoFile);
|
|
|
+ videoRepository.saveVideo(videoFile, videoPost);
|
|
|
+ return videoId;
|
|
|
}
|
|
|
|
|
|
public Result publishVideoPost(VideoPublishSbt videoPublishSbt) {
|