feat(events): 每个事件生成对应时间点画面截图 - oracle_db.mark_video_processed 返回 event_ids;video_processor 按事件时间戳-视频起始时间偏移跳帧截图存 ev_{id}.jpg;新增 /api/oracle/event/{id}/thumb 接口;fam-ui 事件列表每条显示对应截图
This commit is contained in:
@@ -157,7 +157,8 @@ class OracleDB:
|
||||
return cur.fetchall()
|
||||
|
||||
def mark_video_processed(self, video_id: int, summary: str, events: List[dict],
|
||||
people: List[str], compute_provider: str):
|
||||
people: List[str], compute_provider: str) -> List[int]:
|
||||
"""落库视频结果;返回新插入事件的 id 列表(与 events 参数一一对应,供事件截图用)"""
|
||||
now = _now_iso()
|
||||
self._conn.execute(
|
||||
"UPDATE videos SET status='done', summary_json=?, events_json=?, "
|
||||
@@ -166,14 +167,17 @@ class OracleDB:
|
||||
compute_provider, now, now, video_id))
|
||||
# 事件落独立表,便于 NAS 拉取
|
||||
self._conn.execute("DELETE FROM events WHERE video_id=?", (video_id,))
|
||||
event_ids: List[int] = []
|
||||
for ev in events:
|
||||
self._conn.execute(
|
||||
cur = self._conn.execute(
|
||||
"INSERT INTO events (video_id, ts, description, person_list_json, "
|
||||
"is_attention_event) VALUES (?,?,?,?,?)",
|
||||
(video_id, ev.get('timestamp', ''), ev.get('description', ''),
|
||||
json.dumps(ev.get('people', []), ensure_ascii=False),
|
||||
1 if ev.get('is_attention_event') else 0))
|
||||
event_ids.append(cur.lastrowid)
|
||||
self._conn.commit()
|
||||
return event_ids
|
||||
|
||||
def mark_video_failed(self, video_id: int, error: str = ''):
|
||||
now = _now_iso()
|
||||
|
||||
Reference in New Issue
Block a user