Compare commits
No commits in common. "e1386b891e89f9b49abe408588d7d89c5cce4d4e" and "8c7893d9890b6a9039857b90938e309364f620b1" have entirely different histories.
e1386b891e
...
8c7893d989
|
|
@ -147,49 +147,6 @@ text_template_h_1 = {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
autotext_template_v_1 = {
|
|
||||||
"type": "text",
|
|
||||||
"track": 4,
|
|
||||||
"time": 0,
|
|
||||||
"y": "87.9086%",
|
|
||||||
"width": "100%",
|
|
||||||
"height": "40%",
|
|
||||||
"x_alignment": "50%",
|
|
||||||
"y_alignment": "50%",
|
|
||||||
"font_family": "Noto Sans",
|
|
||||||
"font_weight": "700",
|
|
||||||
"font_size": "8 vmin",
|
|
||||||
"background_color": "rgba(216,216,216,0)",
|
|
||||||
"background_x_padding": "33%",
|
|
||||||
"background_y_padding": "7%",
|
|
||||||
"background_border_radius": "28%",
|
|
||||||
"transcript_source": "audio-music", # audio-music과 연동됨
|
|
||||||
"transcript_effect": "karaoke",
|
|
||||||
"fill_color": "#ffffff",
|
|
||||||
"stroke_color": "rgba(51,51,51,1)",
|
|
||||||
"stroke_width": "0.6 vmin"
|
|
||||||
}
|
|
||||||
autotext_template_h_1 = {
|
|
||||||
"type": "text",
|
|
||||||
"track": 4,
|
|
||||||
"time": 0,
|
|
||||||
"x": "10%",
|
|
||||||
"y": "83.2953%",
|
|
||||||
"width": "80%",
|
|
||||||
"height": "15%",
|
|
||||||
"x_anchor": "0%",
|
|
||||||
"y_anchor": "0%",
|
|
||||||
"x_alignment": "50%",
|
|
||||||
"font_family": "Noto Sans",
|
|
||||||
"font_weight": "700",
|
|
||||||
"font_size": "5.9998 vmin",
|
|
||||||
"transcript_source": "audio-music",
|
|
||||||
"transcript_effect": "karaoke",
|
|
||||||
"fill_color": "#ffffff",
|
|
||||||
"stroke_color": "#333333",
|
|
||||||
"stroke_width": "0.2 vmin"
|
|
||||||
}
|
|
||||||
|
|
||||||
async def get_shared_client() -> httpx.AsyncClient:
|
async def get_shared_client() -> httpx.AsyncClient:
|
||||||
"""공유 HTTP 클라이언트를 반환합니다. 없으면 생성합니다."""
|
"""공유 HTTP 클라이언트를 반환합니다. 없으면 생성합니다."""
|
||||||
global _shared_client
|
global _shared_client
|
||||||
|
|
@ -736,10 +693,7 @@ class CreatomateService:
|
||||||
text_scene["elements"][0]["name"] = f"lyric-{lyric_index}"
|
text_scene["elements"][0]["name"] = f"lyric-{lyric_index}"
|
||||||
text_scene["elements"][0]["text"] = lyric_text
|
text_scene["elements"][0]["text"] = lyric_text
|
||||||
return text_scene
|
return text_scene
|
||||||
|
|
||||||
def auto_lyric(self, auto_text_template : dict):
|
|
||||||
text_scene = copy.deepcopy(auto_text_template)
|
|
||||||
return text_scene
|
|
||||||
|
|
||||||
def get_text_template(self):
|
def get_text_template(self):
|
||||||
match self.orientation:
|
match self.orientation:
|
||||||
|
|
@ -747,11 +701,4 @@ class CreatomateService:
|
||||||
return text_template_v_2
|
return text_template_v_2
|
||||||
case "horizontal":
|
case "horizontal":
|
||||||
return text_template_h_1
|
return text_template_h_1
|
||||||
|
|
||||||
def get_auto_text_template(self):
|
|
||||||
match self.orientation:
|
|
||||||
case "vertical":
|
|
||||||
return autotext_template_v_1
|
|
||||||
case "horizontal":
|
|
||||||
return autotext_template_h_1
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,6 @@ from app.video.schemas.video_schema import (
|
||||||
)
|
)
|
||||||
from app.video.worker.video_task import download_and_upload_video_to_blob
|
from app.video.worker.video_task import download_and_upload_video_to_blob
|
||||||
|
|
||||||
from config import creatomate_settings
|
|
||||||
|
|
||||||
logger = get_logger("video")
|
logger = get_logger("video")
|
||||||
|
|
||||||
router = APIRouter(prefix="/video", tags=["Video"])
|
router = APIRouter(prefix="/video", tags=["Video"])
|
||||||
|
|
@ -350,22 +348,17 @@ async def generate_video(
|
||||||
f"[generate_video] timestamp[{i}]: lyric_line={ts.lyric_line}, start_time={ts.start_time}, end_time={ts.end_time}"
|
f"[generate_video] timestamp[{i}]: lyric_line={ts.lyric_line}, start_time={ts.start_time}, end_time={ts.end_time}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# LYRIC AUTO 결정부
|
text_template = creatomate_service.get_text_template()
|
||||||
if (creatomate_settings.DEBUG_AUTO_LYRIC):
|
for idx, aligned in enumerate(song_timestamp_list):
|
||||||
auto_text_template = creatomate_service.get_auto_text_template()
|
caption = creatomate_service.lining_lyric(
|
||||||
final_template["source"]["elements"].append(creatomate_service.auto_lyric(auto_text_template))
|
text_template,
|
||||||
else :
|
idx,
|
||||||
text_template = creatomate_service.get_text_template()
|
aligned.lyric_line,
|
||||||
for idx, aligned in enumerate(song_timestamp_list):
|
aligned.start_time,
|
||||||
caption = creatomate_service.lining_lyric(
|
aligned.end_time,
|
||||||
text_template,
|
)
|
||||||
idx,
|
final_template["source"]["elements"].append(caption)
|
||||||
aligned.lyric_line,
|
|
||||||
aligned.start_time,
|
|
||||||
aligned.end_time,
|
|
||||||
)
|
|
||||||
final_template["source"]["elements"].append(caption)
|
|
||||||
# END - LYRIC AUTO 결정부
|
|
||||||
# logger.debug(
|
# logger.debug(
|
||||||
# f"[generate_video] final_template: {json.dumps(final_template, indent=2, ensure_ascii=False)}"
|
# f"[generate_video] final_template: {json.dumps(final_template, indent=2, ensure_ascii=False)}"
|
||||||
# )
|
# )
|
||||||
|
|
|
||||||
|
|
@ -155,10 +155,6 @@ class CreatomateSettings(BaseSettings):
|
||||||
default=30.0,
|
default=30.0,
|
||||||
description="가로형 템플릿 기본 duration (초)",
|
description="가로형 템플릿 기본 duration (초)",
|
||||||
)
|
)
|
||||||
DEBUG_AUTO_LYRIC: bool = Field(
|
|
||||||
default = False,
|
|
||||||
description = "Creatomate 자동 가사 생성 기능 사용 여부"
|
|
||||||
)
|
|
||||||
|
|
||||||
model_config = _base_config
|
model_config = _base_config
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue