aboutsummaryrefslogtreecommitdiff
path: root/client.py
diff options
context:
space:
mode:
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: