aboutsummaryrefslogtreecommitdiff
path: root/client.py
diff options
context:
space:
mode:
authorFranoosh <uinarf@autistici.org>2026-05-26 16:32:13 +0200
committerFranoosh <uinarf@autistici.org>2026-05-26 16:32:13 +0200
commit28150dd2c4d03ed844e8d1a5cfc463f5d1f9b45f (patch)
tree2d19117780a7245b2130119ef374cae4e6fb1166 /client.py
parenta241288241a9dc300014ecfc93c4f537900f3e9f (diff)
downloadZeroMQ_Video_Streaming-28150dd2c4d03ed844e8d1a5cfc463f5d1f9b45f.tar.gz
ZeroMQ_Video_Streaming-28150dd2c4d03ed844e8d1a5cfc463f5d1f9b45f.tar.bz2
ZeroMQ_Video_Streaming-28150dd2c4d03ed844e8d1a5cfc463f5d1f9b45f.zip
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
Diffstat (limited to 'client.py')
-rw-r--r--client.py17
1 files changed, 8 insertions, 9 deletions
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: