Compare commits

..

No commits in common. "a7b7a571c301cfd4264750af62f71ed25d20ed48" and "4468400a0e5b8956aeff61043f23567622aa9599" have entirely different histories.

1 changed files with 2 additions and 5 deletions

View File

@ -127,11 +127,8 @@ def _process_stream(camera):
if cap is None: if cap is None:
cap = cv2.VideoCapture(rtsp_url) cap = cv2.VideoCapture(rtsp_url)
if not cap.isOpened(): 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" with lock: state["cameras"][cam_id]["status"] = "error"
time.sleep(10); cap = None; continue time.sleep(5); cap = None; continue
print(f"[SUCCESS] {camera['name']} (IP: {camera['ip']}) connected and streaming over TCP.")
with lock: state["cameras"][cam_id]["status"] = "live" with lock: state["cameras"][cam_id]["status"] = "live"
ret, frame = cap.read() ret, frame = cap.read()
@ -301,7 +298,7 @@ def serve_alert_image(filename): return send_from_directory("alerts", filename)
if __name__ == "__main__": if __name__ == "__main__":
for cam in CAMERAS: threading.Thread(target=_process_stream, args=(cam,), daemon=True).start() for cam in CAMERAS: threading.Thread(target=_process_stream, args=(cam,), daemon=True).start()
time.sleep(1.5) time.sleep(1)
threading.Thread(target=_update_grid_frame, daemon=True).start() threading.Thread(target=_update_grid_frame, daemon=True).start()
print("\n Grid View Dashboard → http://localhost:5000\n") print("\n Grid View Dashboard → http://localhost:5000\n")
app.run(host="0.0.0.0", port=5000, debug=False, threaded=True) app.run(host="0.0.0.0", port=5000, debug=False, threaded=True)