fix(8502): 重生图片自动作废旧视频;记录来源图片签名并提示stale;组图/重生视频路径唯一化
This commit is contained in:
@@ -6,6 +6,7 @@ import logging
|
||||
import time
|
||||
import requests
|
||||
import os
|
||||
from os import stat
|
||||
from typing import Dict, Any, List, Optional
|
||||
from pathlib import Path
|
||||
|
||||
@@ -56,6 +57,21 @@ class VideoGenerator:
|
||||
task_id = self._submit_task(image_url, prompt)
|
||||
|
||||
if task_id:
|
||||
try:
|
||||
st = stat(image_path)
|
||||
source_sig = {
|
||||
"source_image_local_path": image_path,
|
||||
"source_image_size": int(getattr(st, "st_size", 0) or 0),
|
||||
"source_image_mtime": float(getattr(st, "st_mtime", 0.0) or 0.0),
|
||||
"source_image_r2_url": image_url,
|
||||
"submitted_at": time.time(),
|
||||
}
|
||||
except Exception:
|
||||
source_sig = {
|
||||
"source_image_local_path": image_path,
|
||||
"source_image_r2_url": image_url,
|
||||
"submitted_at": time.time(),
|
||||
}
|
||||
# 立即保存 task_id 到数据库,状态为 processing
|
||||
db.save_asset(
|
||||
project_id=project_id,
|
||||
@@ -63,7 +79,8 @@ class VideoGenerator:
|
||||
asset_type="video",
|
||||
status="processing",
|
||||
task_id=task_id,
|
||||
local_path=None
|
||||
local_path=None,
|
||||
metadata=source_sig,
|
||||
)
|
||||
|
||||
return task_id
|
||||
|
||||
Reference in New Issue
Block a user