新增推送新增视频id

This commit is contained in:
zqc
2026-03-03 09:42:26 +08:00
parent 2f649f5e2d
commit e812d7f3e9
5 changed files with 47 additions and 10 deletions

View File

@@ -6,6 +6,8 @@ from typing import Dict, Any
import threading
import time
import queue
import requests
from common.contants import ALERT_PUSH_URL
# -------------------------- Kadian 检测相关导入 --------------------------
from algorithm.common.npu_yolo_onnx_person_car_phone import YOLOv8_ONNX # 主检测模型(人/车/后备箱/手机)
@@ -897,7 +899,7 @@ class FrameProcessorWorker(threading.Thread):
msg = {
"msg_type": "frame",
"camera_id": 0,
"camera_id": item["camera_index"],
"timestamp": ts,
# "result_type": action_names,
"result_type": push_actions,
@@ -905,8 +907,18 @@ class FrameProcessorWorker(threading.Thread):
}
try:
self.ws_queue.put(msg, timeout=1.0)
# if push_actions and len(push_actions) > 0:
# self.ws_queue_2.put(msg, timeout=1.0)
if push_actions and len(push_actions) > 0:
# 发送POST请求
post_msg = msg.copy()
post_msg['type'] = 1
try:
response = requests.post(ALERT_PUSH_URL, json=post_msg, timeout=5.0)
if response.status_code == 200:
print(f"[INFO] POST alert sent successfully for actions: {push_actions}")
else:
print(f"[WARN] POST alert failed with status: {response.status_code}")
except Exception as e:
print(f"[ERROR] POST alert request failed: {e}")
except queue.Full:
logger.warning("[WARN] ws_send_queue full, drop frame message")