|
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.map.MapUtil;
|
|
import cn.hutool.core.map.MapUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.http.HttpRequest;
|
|
import cn.hutool.http.HttpRequest;
|
|
|
|
|
+import cn.hutool.http.HttpResponse;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
import cn.hutool.http.HttpUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
@@ -189,7 +190,9 @@ public class LumaServiceImpl implements LumaService {
|
|
|
lumaUserConversation.setStatus(submitResult.getState());
|
|
lumaUserConversation.setStatus(submitResult.getState());
|
|
|
SubmitResult.Video video = submitResult.getVideo();
|
|
SubmitResult.Video video = submitResult.getVideo();
|
|
|
lumaUserConversation.setFinishTime(System.currentTimeMillis());
|
|
lumaUserConversation.setFinishTime(System.currentTimeMillis());
|
|
|
- lumaUserConversation.setVideoUrl(video.getUrl());
|
|
|
|
|
|
|
+ //出水印
|
|
|
|
|
+ String removeVideoWatermarkUrl = removeVideoWatermark(lumaUserConversation.getTaskId());
|
|
|
|
|
+ lumaUserConversation.setVideoUrl(removeVideoWatermarkUrl);
|
|
|
lumaUserConversation.setThumbnail(video.getThumbnail());
|
|
lumaUserConversation.setThumbnail(video.getThumbnail());
|
|
|
TASK_EXECUTOR.execute(() -> {
|
|
TASK_EXECUTOR.execute(() -> {
|
|
|
//同步
|
|
//同步
|
|
@@ -201,7 +204,7 @@ public class LumaServiceImpl implements LumaService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public void submitVideoNotify(String json) {
|
|
|
|
|
|
|
+ public void submitVideoNotify(String json) throws Exception {
|
|
|
log.info("notifyHook:{}", json);
|
|
log.info("notifyHook:{}", json);
|
|
|
if (StrUtil.isEmpty(json)) {
|
|
if (StrUtil.isEmpty(json)) {
|
|
|
return;
|
|
return;
|
|
@@ -220,7 +223,8 @@ public class LumaServiceImpl implements LumaService {
|
|
|
conversation.setStatus(videoTaskData.getState());
|
|
conversation.setStatus(videoTaskData.getState());
|
|
|
VideoTask.Video video = videoTaskData.getVideo();
|
|
VideoTask.Video video = videoTaskData.getVideo();
|
|
|
if (video != null) {
|
|
if (video != null) {
|
|
|
- conversation.setVideoUrl(video.getUrl());
|
|
|
|
|
|
|
+ String removeVideoWatermarkUrl = removeVideoWatermark(conversation.getTaskId());
|
|
|
|
|
+ conversation.setVideoUrl(removeVideoWatermarkUrl);
|
|
|
conversation.setThumbnail(video.getThumbnail());
|
|
conversation.setThumbnail(video.getThumbnail());
|
|
|
}
|
|
}
|
|
|
conversation.setFailReason(videoTask.getFail_reason());
|
|
conversation.setFailReason(videoTask.getFail_reason());
|
|
@@ -471,4 +475,16 @@ public class LumaServiceImpl implements LumaService {
|
|
|
log.info("上传视频结果:url:{},json:{}", url, result);
|
|
log.info("上传视频结果:url:{},json:{}", url, result);
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 去水印
|
|
|
|
|
+ */
|
|
|
|
|
+ public String removeVideoWatermark(String taskId) throws Exception {
|
|
|
|
|
+ String url = LUMA_BASE_URL + String.format("/luma/generations/%s/download_video_url", taskId);
|
|
|
|
|
+ HttpRequest request = HttpRequest.get(url).header("Authorization", AUTH).setConnectionTimeout(10000);
|
|
|
|
|
+ HttpResponse execute = request.execute();
|
|
|
|
|
+ String body = execute.body();
|
|
|
|
|
+ JSONObject re = Jsons.parseObject(body, JSONObject.class);
|
|
|
|
|
+ return re.getStr("url");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|