fix frontend bug
This commit is contained in:
1 parent
a18f7a5c8b
commit
9bb46f7004
10 files changed
+83
-21
No files matched your search
@@ -14,8 +14,12 @@ def artifact_path(pipeline: str, task_id: str, name: str) -> str:
|
||||
return f"{pipeline}/{task_id}/{name}"
|
||||
|
||||
|
||||
async def store_bytes(pipeline: str, task_id: str, name: str, data: bytes) -> str:
|
||||
return await blob.upload_bytes(data, artifact_path(pipeline, task_id, name))
|
||||
async def store_bytes(pipeline: str, task_id: str, name: str, data: bytes, *,
|
||||
download_as: str | None = None) -> str:
|
||||
"""download_as를 주면 브라우저가 그 주소를 열 때 그 이름으로 내려받는다"""
|
||||
return await blob.upload_bytes(
|
||||
data, artifact_path(pipeline, task_id, name),
|
||||
disposition=blob.as_attachment(download_as) if download_as else None)
|
||||
|
||||
|
||||
async def store_image(pipeline: str, task_id: str, name: str, image: Image.Image) -> str:
|
||||
|
||||
@@ -242,8 +242,9 @@ async def run_compose(session: AsyncSession, task: PlayreelTask) -> None:
|
||||
compose_longcut, poster, clip, timeline, narration, sections, band_info(meta),
|
||||
bgm_mp3=bgm, qr=Image.open(qr_path) if qr_path.exists() else None)
|
||||
|
||||
task.video_url = await store_bytes(PIPELINE, task.id,
|
||||
f"longcut_v{task.version + 1}.mp4", result.video)
|
||||
filename = f"{task.slug}_30_v{task.version + 1}.mp4"
|
||||
task.video_url = await store_bytes(PIPELINE, task.id, filename, result.video,
|
||||
download_as=filename)
|
||||
task.scene_plan = result.plan.model_dump()
|
||||
task.video_duration = result.duration
|
||||
task.video_frames = result.frames
|
||||
|
||||
@@ -67,6 +67,9 @@ async def run_narration_text(session: AsyncSession, task: PosterAliveTask) -> No
|
||||
task.narration_voice = answer.voice
|
||||
task.bgm_style = answer.bgm_style.model_dump()
|
||||
task.poster_metadata = answer.metadata.model_dump()
|
||||
# 올릴 때 이름을 안 줬으면 포스터에서 읽은 행사명이 이름이 된다
|
||||
if not task.name:
|
||||
task.name = answer.metadata.event_name
|
||||
task.state = PosterAliveState.MOTION
|
||||
await session.commit()
|
||||
|
||||
@@ -131,9 +134,11 @@ async def run_render(session: AsyncSession, task: PosterAliveTask) -> None:
|
||||
result = await asyncio.to_thread(render, clip, poster, narration=narration, bgm=bgm,
|
||||
timeline=timeline)
|
||||
|
||||
task.video_url = await store_bytes(PIPELINE, task.id, "final.mp4", result.video)
|
||||
task.video_url = await store_bytes(PIPELINE, task.id, "final.mp4", result.video,
|
||||
download_as=f"{task.name}.mp4")
|
||||
task.thumbnail_url = await store_bytes(PIPELINE, task.id, "thumbnail.jpg",
|
||||
result.thumbnail)
|
||||
result.thumbnail,
|
||||
download_as=f"{task.name}.jpg")
|
||||
task.video_duration = result.duration
|
||||
task.video_frames = result.frames
|
||||
task.video_width = result.width
|
||||
|
||||
Reference in new issue
Block a user