-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cast api 코드 수정 #38
Cast api 코드 수정 #38
Conversation
…cast/OwnCast_backend into enhance/cast-api/29 # Conflicts: # src/main/java/com/umc/owncast/domain/cast/controller/CastController.java # src/main/java/com/umc/owncast/domain/cast/service/CastService.java # src/main/java/com/umc/owncast/domain/cast/service/TTSService.java # src/main/java/com/umc/owncast/domain/sentence/service/SentenceService.java # src/main/java/com/umc/owncast/domain/sentence/service/SentenceServiceImpl.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
캐스트 생성 할 때 응답에 script가 빕니다
아래 리뷰 참고해주세욥
private @NotNull ApiResponse<Object> getObjectApiResponse(KeywordCastCreationDTO castRequest, String script) { | ||
TTSResultDTO ttsResult = ttsService.createSpeech(script, castRequest); | ||
Double audioLength = ttsResult.getTimePointList().get(ttsResult.getTimePointList().size() - 1); | ||
int minutes = (int) (audioLength / 60); | ||
int seconds = (int) Math.round(audioLength % 60); | ||
|
||
Cast cast = Cast.builder() | ||
.voice(castRequest.getVoice()) | ||
.audioLength(0) // TODO mp3 파일 길이 가져오기 | ||
.audioLength(String.format("%02d:%02d", minutes, seconds)) | ||
.filePath(ttsResult.getMp3Path()) | ||
.formality(castRequest.getFormality()) | ||
.member(null) // TODO 회원 기능 만들어지면 자기자신 넣기 | ||
.language(null) // TODO 회원 기능 만들어지면 언어 설정 넣기 | ||
.isPublic(false) | ||
.hits(0L) | ||
.build(); | ||
List<Sentence> sentences = sentenceService.mapToSentence( | ||
script, | ||
translateService.translate(script), | ||
ttsResult, | ||
cast | ||
); | ||
cast.addSentences(sentences); | ||
castRepository.save(cast); | ||
sentenceRepository.saveAll(sentences); | ||
cast = castRepository.save(cast); | ||
sentenceService.save(script, ttsResult, cast); | ||
|
||
CastScriptDTO response = new CastScriptDTO(cast); | ||
return ApiResponse.of(SuccessCode._OK, response); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
리팩토링 해주셨군요 👍
근데 함수명은 바꾸는 게 좋을 거 같아요 (인텔리제이가 추천해준 이름 같은데 의미가 불명확함)
차라리 saveCastCreation
같은 느낌으로 바꾼 다음에
ApiResponse 말고 CastScriptDTO만 반환하게 하는 게 어떨까요
audioLength 구하는 부분은 좋네요
외부 라이브러리 가져와서 mp3 길이 구하고 이런 거 생각하고 있었는데 ssml 태그 사용하면 됐었네..
근데 timePoint 태그가 스크립트 맨 끝에도 붙는 거죠??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넹 맨끝에 붙어요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
빼놓고 수정 까먹었네요 함수명 수정하겠습니다~~!
- sentenceService.save()가 List<Sentence>를 반환하도록 변경
DONE