|
|
@@ -10,6 +10,7 @@ import cn.reghao.oss.sdk.model.dto.media.VideoUrlDto;
|
|
|
import cn.reghao.tnb.common.auth.UserContext;
|
|
|
import cn.reghao.tnb.content.api.constant.PostScope;
|
|
|
import cn.reghao.tnb.content.api.constant.VideoStatus;
|
|
|
+import cn.reghao.tnb.content.api.dto.VideoFilePublish;
|
|
|
import cn.reghao.tnb.content.api.dto.VideoFileUpdate;
|
|
|
import cn.reghao.tnb.content.api.dto.VideoPublishSbt;
|
|
|
import cn.reghao.tnb.content.app.vod.db.mapper.*;
|
|
|
@@ -63,6 +64,26 @@ public class VideoPostServiceImpl implements VideoPostService {
|
|
|
this.videoCategoryPostMapper = videoCategoryPostMapper;
|
|
|
}
|
|
|
|
|
|
+ public String publishVideoFile(VideoFilePublish videoFilePublish) {
|
|
|
+ String title = videoFilePublish.getFilename();
|
|
|
+ String videoFileId = videoFilePublish.getVideoFileId();
|
|
|
+ int channelCode = videoFilePublish.getChannelCode();
|
|
|
+ try {
|
|
|
+ VideoInfo videoInfo = ossService.getVideoInfo(channelCode, videoFileId);
|
|
|
+ String videoId = idGenerator.getUuid();
|
|
|
+ VideoFile videoFile = new VideoFile(videoId, videoInfo, channelCode);
|
|
|
+ VideoPost videoPost = new VideoPost(videoId, title, videoFile);
|
|
|
+ videoRepository.saveVideo(videoFile, videoPost);
|
|
|
+ return videoId;
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ String errMsg = String.format("视频文件 %s 在 oss 中不存在", videoFileId);
|
|
|
+ log.error("{}", e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
public Result publishVideo(VideoPublishSbt videoPublishSbt) {
|
|
|
Result result;
|
|
|
try {
|
|
|
@@ -85,12 +106,6 @@ public class VideoPostServiceImpl implements VideoPostService {
|
|
|
|
|
|
String videoId = idGenerator.getUuid();
|
|
|
VideoFile videoFile = new VideoFile(videoId, videoInfo, channelCode);
|
|
|
- String videoCodec = videoInfo.getVideoCodec();
|
|
|
- String audioCodec = videoInfo.getAudioCodec();
|
|
|
- if (audioCodec == null) {
|
|
|
- audioCodec = "empty";
|
|
|
- }
|
|
|
- String codec = String.format("%s&%s", videoCodec, audioCodec);
|
|
|
|
|
|
Integer channelScope = ossService.getChannelScope(channelCode);
|
|
|
if (channelScope == null ) {
|