From 639cb3fafd65d5e44ffa9ab7eea6405be2e61f00 Mon Sep 17 00:00:00 2001 From: Calin Crisan <ccrisan@gmail.com> Date: Tue, 24 Jan 2017 17:40:01 +0200 Subject: [PATCH] fixed editable mask shifting on some unusual resolutions --- motioneye/utils.py | 4 ++-- motioneye/wsswitch.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/motioneye/utils.py b/motioneye/utils.py index 4d52ff3..34e5bd7 100644 --- a/motioneye/utils.py +++ b/motioneye/utils.py @@ -829,11 +829,11 @@ def build_editable_mask_file(camera_id, mask_lines, capture_width=None, capture_ # scale the mask vertically in case the aspect ratio has changed # since the last time the mask has been generated - if mask_height == len(mask_lines): + if ny == len(mask_lines): line_index_func = lambda y: y else: - line_index_func = lambda y: (len(mask_lines) - 1) * y / (mask_height - 1) + line_index_func = lambda y: (len(mask_lines) - 1) * y / (ny - 1) rh = height / ny # rectangle height diff --git a/motioneye/wsswitch.py b/motioneye/wsswitch.py index 74895bd..3c34afb 100644 --- a/motioneye/wsswitch.py +++ b/motioneye/wsswitch.py @@ -81,7 +81,8 @@ def _check_ws(): def on_motion_detection_status(camera_id, must_be_enabled, working_schedule_type, enabled=None, error=None): if error: # could not detect current status - return logging.warn('skipping motion detection status update for camera with id %(id)s' % {'id': camera_id}) + return logging.warn('skipping motion detection status update for camera with id %(id)s: %(error)s' % { + 'id': camera_id, 'error': error}) if enabled and not must_be_enabled: logging.debug('must disable motion detection for camera with id %(id)s (%(what)s working schedule)' % { -- 2.39.5