From 28150dd2c4d03ed844e8d1a5cfc463f5d1f9b45f Mon Sep 17 00:00:00 2001 From: Franoosh Date: Tue, 26 May 2026 16:32:13 +0200 Subject: client.cfg : move log dir to /var/log client.py : use ComputingContoursException and DetectMovementException helpers.py : define ComputingContoursException and DetectMovementException clients.html : small changes webserver.py : minor changes worker.py : log disconnectd from web client on debug, not info --- client.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'client.py') diff --git a/client.py b/client.py index 81c8f8b..7b7a697 100644 --- a/client.py +++ b/client.py @@ -35,6 +35,8 @@ from helpers import ( bytes_to_timestamp, write_yappi_stats, auth_service, + ComputingContoursException, + DetectMovementException, ) ################################################### @@ -187,8 +189,7 @@ class ClientVideo(Thread): List of contours to draw on a frame """ - raw_frame = self.frame_deque[-1][2] - scaling_factor = self.frame_deque[-1][1] + _, scaling_factor, raw_frame = self.frame_deque[-1] scaled_contours = scale_contours(contours, scaling_factor) try: frame_out = draw_contours( @@ -262,15 +263,13 @@ class ClientVideo(Thread): sample_frames = self.frame_deque[0][0], self.frame_deque[-1][0] try: contours = compute_contours(sample_frames) - except Exception as exc: - logger.error("ClientVideo %r: Error computing contours: %r", self.identity, exc) - continue - try: movement_now = detect_movement(contours, min_area=self.device_threshold) - except Exception as exc: - logger.error("ClientVideo %r: Error detecting movement: %r", self.identity, exc) + except ComputingContoursException: + logger.error("ClientVideo %r: Error computing contours", self.identity) + continue + except DetectMovementException: + logger.error("ClientVideo %r: Error detecting movement", self.identity) continue - # Only update movement start time and send start message # if movement is detected and was not detected before: if movement_now: -- cgit v1.3