언어선택에 따른 자막생성 구현
This commit is contained in:
1 parent
bdee852bed
commit
997927d42a
10 files changed
+149
-45
No files matched your search
+7
-5
@@ -60,7 +60,7 @@ from typing import Any
|
||||
import httpx
|
||||
|
||||
from app.song.schemas.song_schema import PollingSongResponse, SongClipData
|
||||
from app.utils.bgm_lyrics import get_random_bgm_lyrics
|
||||
from app.utils.bgm_lyrics import get_bgm_lyrics, normalize_genre as _normalize_genre
|
||||
from app.utils.logger import get_logger
|
||||
from config import apikey_settings, recovery_settings
|
||||
|
||||
@@ -129,10 +129,12 @@ class SunoService:
|
||||
"""
|
||||
actual_callback_url = callback_url or apikey_settings.SUNO_CALLBACK_URL
|
||||
|
||||
normalized_genre = _normalize_genre(genre) if genre else None
|
||||
|
||||
if instrumental:
|
||||
bgm_lyrics, bgm_version = get_random_bgm_lyrics()
|
||||
bgm_lyrics = get_bgm_lyrics(genre)
|
||||
formatted_prompt = f"[Song Duration: Around 1 minute - Must be around 60 seconds]\n{bgm_lyrics}"
|
||||
logger.info(f"[Suno] BGM 더미 가사 버전 {bgm_version} 선택됨")
|
||||
logger.info(f"[Suno] BGM 더미 가사 장르 {normalized_genre} 선택됨")
|
||||
else:
|
||||
formatted_prompt = (
|
||||
f"[Song Duration: Exactly 1 minute - Must be precisely 60 seconds]\n{prompt}"
|
||||
@@ -145,8 +147,8 @@ class SunoService:
|
||||
"prompt": formatted_prompt,
|
||||
"callBackUrl": actual_callback_url,
|
||||
}
|
||||
if genre:
|
||||
payload["style"] = f"{genre}, around 60 seconds" if instrumental else genre
|
||||
if normalized_genre:
|
||||
payload["style"] = f"{normalized_genre}, around 60 seconds" if instrumental else normalized_genre
|
||||
|
||||
last_error: Exception | None = None
|
||||
|
||||
|
||||
Reference in new issue
Block a user