feat: parallelize ad recreation intake

This commit is contained in:
2026-05-18 10:31:18 +08:00
parent 75c5d113ee
commit 4c8cb066d6
5 changed files with 161 additions and 37 deletions

View File

@@ -1657,8 +1657,11 @@ def pipeline_analyze(
raise RuntimeError("source.mp4 不存在,先完成下载")
wav = d / "audio.wav"
audio_running = job_id in AUDIO_WORKERS_RUNNING or job.audio_script.status == "rewriting"
if wav.exists():
update(job, status="splitting", message="复用音轨 · 准备抽帧…", progress=35, source_audio_url=f"/jobs/{job_id}/audio.wav")
elif audio_running:
update(job, status="splitting", message="音频路并行处理中 · 准备抽帧…", progress=35)
else:
update(job, status="splitting", message="ffmpeg 拆分音轨…", progress=35)
run([
@@ -1778,7 +1781,7 @@ def pipeline_analyze(
)
update(
job,
status="frames_extracted",
status="transcribed" if job.transcript else "frames_extracted",
frames=merged_frames,
progress=70,
error="",
@@ -3140,8 +3143,8 @@ async def trigger_analyze(
job = JOBS.get(job_id)
if not job:
raise HTTPException(404, "job not found")
if job.status not in {"downloaded", "frames_extracted", "transcribed", "failed"}:
raise HTTPException(409, f"status must be downloaded/failed, got {job.status}")
if job.status not in {"downloaded", "frames_extracted", "transcribed", "transcribing", "failed"}:
raise HTTPException(409, f"status must be downloaded/transcribing/failed, got {job.status}")
ANALYZE_QUEUE.append((job_id, frames, target, mode, quality))
position = len(ANALYZE_QUEUE)
update(