fix: 恢复被误回退的后端文件(#1519 #1520)

This commit is contained in:
xiaoxia
2026-08-27 15:05:32 +08:00
parent b12bb24d08
commit fc7218ac2f
5 changed files with 64 additions and 6 deletions
@@ -278,6 +278,7 @@ def extract_and_upload_cover_frames(
video_path: str,
plan_id: str,
*,
task_id: str = "",
num_frames: int = 3,
title_text: str = "",
title_color: str = "#ffffff",
@@ -291,6 +292,7 @@ def extract_and_upload_cover_frames(
Args:
video_path: 视频文件路径
plan_id: 编辑计划 ID(用于生成 storage key
task_id: 任务 ID(用于生成独立的 storage key,避免标题变更时封面冲突)
num_frames: 抽取帧数(默认 3
title_text: 标题文字;非空时用 Pillow 叠加到每帧。
从已渲染视频抽帧时通常传空(标题已烧录);从源素材抽帧时传标题。
@@ -338,7 +340,7 @@ def extract_and_upload_cover_frames(
font_size=title_font_size,
)
storage_key = f"covers/{plan_id}/mediakit_frame_{i}.jpg"
storage_key = f"covers/{plan_id}/{task_id}/mediakit_frame_{i}.jpg"
url = upload_to_oss(tmp.name, storage_key)
if url:
seek_time = frame.get("timestamp", 0.0)
@@ -377,7 +379,7 @@ def extract_and_upload_cover_frames(
position=title_position,
font_size=title_font_size,
)
storage_key = f"covers/{plan_id}/frame_{i}.jpg"
storage_key = f"covers/{plan_id}/{task_id}/frame_{i}.jpg"
url = upload_to_oss(frame_path, storage_key)
if url:
seek_time = max(0.5, duration * ratio) if duration > 0 else 0.0