]> www.vanbest.org Git - motioneye-debian/commitdiff
adapted "gap" and "output_all" directives to new motion config format
authorCalin Crisan <ccrisan@gmail.com>
Mon, 11 Aug 2014 16:43:12 +0000 (19:43 +0300)
committerCalin Crisan <ccrisan@gmail.com>
Mon, 11 Aug 2014 16:43:12 +0000 (19:43 +0300)
src/config.py
static/js/main.js
templates/main.html

index 906fe0b52d02fa1ef6edd137c6dfb858fbf50ae6..29844050f9db2285e660f06d334d288f4285cea9 100644 (file)
@@ -271,6 +271,8 @@ def get_camera(camera_id, as_lines=False):
             
             if 'output_normal' in camera_config:
                 camera_config['output_pictures'] = camera_config.pop('output_normal')
+            if 'output_all' in camera_config:
+                camera_config['emulate_motion'] = camera_config.pop('output_all')
             if 'ffmpeg_cap_new' in camera_config:
                 camera_config['ffmpeg_output_movies'] = camera_config.pop('ffmpeg_cap_new')
             if 'locate' in camera_config:
@@ -287,6 +289,8 @@ def get_camera(camera_id, as_lines=False):
                 camera_config['stream_maxrate'] = camera_config.pop('webcam_maxrate')
             if 'webcam_localhost' in camera_config:
                 camera_config['stream_localhost'] = camera_config.pop('webcam_localhost')
+            if 'gap' in camera_config:
+                camera_config['event_gap'] = camera_config.pop('gap')
                 
         _set_default_motion_camera(camera_id, camera_config, False)
     
@@ -310,6 +314,8 @@ def set_camera(camera_id, camera_config):
             
             if 'output_pictures' in camera_config:
                 camera_config['output_normal'] = camera_config.pop('output_pictures')
+            if 'emulate_motion' in camera_config:
+                camera_config['output_all'] = camera_config.pop('emulate_motion')
             if 'ffmpeg_output_movies' in camera_config:
                 camera_config['ffmpeg_cap_new'] = camera_config.pop('ffmpeg_output_movies')
             if 'locate_motion_mode' in camera_config:
@@ -326,6 +332,8 @@ def set_camera(camera_id, camera_config):
                 camera_config['webcam_maxrate'] = camera_config.pop('stream_maxrate')
             if 'stream_localhost' in camera_config:
                 camera_config['webcam_localhost'] = camera_config.pop('stream_localhost')
+            if 'event_gap' in camera_config:
+                camera_config['gap'] = camera_config.pop('event_gap')
         
         _set_default_motion_camera(camera_id, camera_config, old_motion)
         
@@ -563,8 +571,7 @@ def camera_ui_to_dict(ui):
         
         # still images
         'output_pictures': False,
-        'output_all': False,
-        'output_motion': False,
+        'emulate_motion': False,
         'snapshot_interval': 0,
         'picture_filename': '',
         'snapshot_filename': '',
@@ -582,7 +589,7 @@ def camera_ui_to_dict(ui):
         'threshold': threshold,
         'noise_tune': ui['auto_noise_detect'],
         'noise_level': max(1, int(round(int(ui['noise_level']) * 2.55))),
-        'gap': int(ui['gap']),
+        'event_gap': int(ui['event_gap']),
         'pre_capture': int(ui['pre_capture']),
         'post_capture': int(ui['post_capture']),
         
@@ -676,7 +683,7 @@ def camera_ui_to_dict(ui):
             data['snapshot_filename'] = ui['image_file_name']
             
         elif capture_mode == 'all-frames':
-            data['output_all'] = True
+            data['emulate_motion'] = True
             data['picture_filename'] = ui['image_file_name']
             
         data['quality'] = max(1, int(ui['image_quality']))
@@ -774,7 +781,7 @@ def camera_dict_to_ui(data):
         'frame_change_threshold': threshold,
         'auto_noise_detect': data['noise_tune'],
         'noise_level': int(int(data['noise_level']) / 2.55),
-        'gap': int(data['gap']),
+        'event_gap': int(data['event_gap']),
         'pre_capture': int(data['pre_capture']),
         'post_capture': int(data['post_capture']),
         
@@ -872,18 +879,18 @@ def camera_dict_to_ui(data):
             ui['right_text'] = 'custom-text'
             ui['custom_right_text'] = text_right
 
-    output_all = data['output_all']
+    emulate_motion = data['emulate_motion']
     output_pictures = data['output_pictures']
     picture_filename = data['picture_filename']
     snapshot_interval = data['snapshot_interval']
     snapshot_filename = data['snapshot_filename']
     
-    if (((output_all or output_pictures) and picture_filename) or
+    if (((emulate_motion or output_pictures) and picture_filename) or
         (snapshot_interval and snapshot_filename)):
         
         ui['still_images'] = True
         
-        if output_all:
+        if emulate_motion:
             ui['capture_mode'] = 'all-frames'
             ui['image_file_name'] = picture_filename
             
@@ -1166,23 +1173,27 @@ def _set_default_motion_camera(camera_id, data, old_motion):
     else:
         data.setdefault('locate_motion_mode', False)
         data.setdefault('locate_motion_style', 'redbox')
+    
     data.setdefault('threshold', 2000)
     data.setdefault('noise_tune', True)
     data.setdefault('noise_level', 32)
     data.setdefault('minimum_motion_frames', 1)
     
-    data.setdefault('gap', 30)
     data.setdefault('pre_capture', 2)
     data.setdefault('post_capture', 4)
     
-    data.setdefault('output_all', False)
     if old_motion:
         data.setdefault('output_normal', False)
         data.setdefault('jpeg_filename', '')
-    
+        data.setdefault('output_all', False)
+        data.setdefault('gap', 30)
+
     else:
         data.setdefault('output_pictures', False)
         data.setdefault('picture_filename', '')
+        data.setdefault('emulate_motion', False)
+        data.setdefault('event_gap', 30)
+    
     data.setdefault('snapshot_interval', 0)
     data.setdefault('snapshot_filename', '')
     data.setdefault('quality', 85)
index d16b0dddfb51463cc7d11ff810fcebf65b4c4ed9..4beaaf475f9029c097a287c2d40b84cc66532077 100644 (file)
@@ -220,7 +220,7 @@ function initUI() {
     makeNumberValidator($('#snapshotIntervalEntry'), 1, 86400, false, false, true);
     makeNumberValidator($('#picturesLifetime'), 1, 3650, false, false, true);
     makeNumberValidator($('#moviesLifetime'), 1, 3650, false, false, true);
-    makeNumberValidator($('#gapEntry'), 1, 86400, false, false, true);
+    makeNumberValidator($('#eventGapEntry'), 1, 86400, false, false, true);
     makeNumberValidator($('#preCaptureEntry'), 0, 100, false, false, true);
     makeNumberValidator($('#postCaptureEntry'), 0, 100, false, false, true);
     
@@ -642,7 +642,7 @@ function cameraUi2Dict() {
         'frame_change_threshold': $('#frameChangeThresholdSlider').val(),
         'auto_noise_detect': $('#autoNoiseDetectSwitch')[0].checked,
         'noise_level': $('#noiseLevelSlider').val(),
-        'gap': $('#gapEntry').val(),
+        'event_gap': $('#eventGapEntry').val(),
         'pre_capture': $('#preCaptureEntry').val(),
         'post_capture': $('#postCaptureEntry').val(),
         
@@ -813,7 +813,7 @@ function dict2CameraUi(dict) {
     $('#frameChangeThresholdSlider').val(dict['frame_change_threshold']);
     $('#autoNoiseDetectSwitch')[0].checked = dict['auto_noise_detect'];
     $('#noiseLevelSlider').val(dict['noise_level']);
-    $('#gapEntry').val(dict['gap']);
+    $('#eventGapEntry').val(dict['event_gap']);
     $('#preCaptureEntry').val(dict['pre_capture']);
     $('#postCaptureEntry').val(dict['post_capture']);
     
index 8c7af352e560793a408e4d9115773e012c22bef0..17985582da06826f0eaa9545fdc82152383dfd78 100644 (file)
                     </tr>
                     <tr class="settings-item advanced-setting">
                         <td class="settings-item-label"><span class="settings-item-label">Motion Gap</span></td>
-                        <td class="settings-item-value"><input type="text" class="number styled motion-detection" id="gapEntry"><span class="settings-item-unit">seconds</span></td>
+                        <td class="settings-item-value"><input type="text" class="number styled motion-detection" id="eventGapEntry"><span class="settings-item-unit">seconds</span></td>
                         <td><span class="help-mark" title="sets the number of seconds of silence (i.e. no motion) that mark the end of a motion event">?</span></td>
                     </tr>
                     <tr class="settings-item advanced-setting">