|
|
@@ -8,6 +8,7 @@ import com.google.common.collect.Lists; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.sm.VoiceInfo; |
|
|
|
import com.iformall.domain.vo.VoiceInfoVo; |
|
|
|
import com.iformall.enums.EnumSex; |
|
|
|
import com.iformall.enums.EnumSpeakType; |
|
|
|
import com.iformall.mapper.VoiceMapper; |
|
|
@@ -28,6 +29,8 @@ public class VoiceInfoServiceImpl implements VoiceInfoService { |
|
|
|
private VoiceMapper voiceMapper; |
|
|
|
|
|
|
|
private final static String str = "\uD83D\uDD57"; |
|
|
|
private final static String url = "https://suimang.oss-accelerate.aliyuncs.com/builtin/tts_all_sample/"; |
|
|
|
private final static String end = ".wav"; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<VoiceInfo> chooseType(Long id) { |
|
|
@@ -35,14 +38,26 @@ public class VoiceInfoServiceImpl implements VoiceInfoService { |
|
|
|
voiceInfos.forEach(x -> { |
|
|
|
if (StringUtils.isNotEmpty(x.getStyleList())) { |
|
|
|
List<String> strings = JSON.parseArray(x.getStyleList(), String.class); |
|
|
|
List<String> list = new ArrayList<>(); |
|
|
|
List<VoiceInfoVo> list = new ArrayList<>(); |
|
|
|
strings.forEach(y->{ |
|
|
|
list.add(EnumSpeakType.getEnum(y).getMessage()); |
|
|
|
VoiceInfoVo infoVo = new VoiceInfoVo(); |
|
|
|
infoVo.setName(EnumSpeakType.getEnum(y).getMessage()); |
|
|
|
infoVo.setUrl(url + x.getMouldSmId() + "_" + y + end); |
|
|
|
list.add(infoVo); |
|
|
|
}); |
|
|
|
|
|
|
|
VoiceInfoVo infoVo = new VoiceInfoVo(); |
|
|
|
infoVo.setName(EnumSpeakType.getEnum(0).getMessage()); |
|
|
|
infoVo.setUrl(url + x.getMouldSmId() + "_" + "default" + end); |
|
|
|
list.add(infoVo); |
|
|
|
x.setStyle(list); |
|
|
|
} else { |
|
|
|
x.setStyle(Lists.newArrayList()); |
|
|
|
|
|
|
|
List<VoiceInfoVo> list = Lists.newArrayList(); |
|
|
|
VoiceInfoVo infoVo = new VoiceInfoVo(); |
|
|
|
infoVo.setName(EnumSpeakType.getEnum(0).getMessage()); |
|
|
|
infoVo.setUrl(url + x.getMouldSmId() + "_" + "default" + end); |
|
|
|
list.add(infoVo); |
|
|
|
x.setStyle(list); |
|
|
|
} |
|
|
|
}); |
|
|
|
return voiceInfos; |
|
|
@@ -66,7 +81,7 @@ public class VoiceInfoServiceImpl implements VoiceInfoService { |
|
|
|
param.setGender(voiceInfo.getSex() == 1 ? "male" : "female"); |
|
|
|
AiPreviewResult result = AiVideoHelper.voicePreview(param); |
|
|
|
if (result.isSuccess()){ |
|
|
|
return new ResultData(result.getUrl()); |
|
|
|
return new ResultData(result.getTime()); |
|
|
|
} |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(), result.getMsg()); |
|
|
|
} |
|
|
|