Compare commits
2 Commits
4468400a0e
...
a7b7a571c3
| Author | SHA1 | Date |
|---|---|---|
|
|
a7b7a571c3 | |
|
|
dcac92d7e5 |
|
|
@ -127,8 +127,11 @@ def _process_stream(camera):
|
|||
if cap is None:
|
||||
cap = cv2.VideoCapture(rtsp_url)
|
||||
if not cap.isOpened():
|
||||
print(f"[ERROR] {camera['name']} (IP: {camera['ip']}) failed to connect. Check if 401 Unauthorized or 403 Forbidden.")
|
||||
with lock: state["cameras"][cam_id]["status"] = "error"
|
||||
time.sleep(5); cap = None; continue
|
||||
time.sleep(10); cap = None; continue
|
||||
|
||||
print(f"[SUCCESS] {camera['name']} (IP: {camera['ip']}) connected and streaming over TCP.")
|
||||
with lock: state["cameras"][cam_id]["status"] = "live"
|
||||
|
||||
ret, frame = cap.read()
|
||||
|
|
@ -298,7 +301,7 @@ def serve_alert_image(filename): return send_from_directory("alerts", filename)
|
|||
|
||||
if __name__ == "__main__":
|
||||
for cam in CAMERAS: threading.Thread(target=_process_stream, args=(cam,), daemon=True).start()
|
||||
time.sleep(1)
|
||||
time.sleep(1.5)
|
||||
threading.Thread(target=_update_grid_frame, daemon=True).start()
|
||||
print("\n Grid View Dashboard → http://localhost:5000\n")
|
||||
app.run(host="0.0.0.0", port=5000, debug=False, threaded=True)
|
||||
|
|
|
|||
Loading…
Reference in New Issue