feat: 新增代码

This commit is contained in:
Daniel
2026-04-07 00:37:39 +08:00
commit 8d0b729f2f
29 changed files with 1768 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import json
from pathlib import Path
from typing import Any, Dict
TASK_VIDEO_NAME = "video.mp4"
TASK_FIRST_FRAME_NAME = "first_frame.jpg"
TASK_METADATA_NAME = "metadata.json"
TASK_LOG_NAME = "run.log"
def ensure_dir(path: Path) -> Path:
path.mkdir(parents=True, exist_ok=True)
return path
def task_output_dir(base_output_dir: Path, task_id: str) -> Path:
return ensure_dir(base_output_dir / task_id)
def write_json(path: Path, data: Dict[str, Any]) -> None:
path.parent.mkdir(parents=True, exist_ok=True)
with path.open("w", encoding="utf-8") as f:
json.dump(data, f, ensure_ascii=False, indent=2)