]> www.vanbest.org Git - motioneye-debian/commitdiff
light switch detection moved to motion detection section
authorCalin Crisan <ccrisan@gmail.com>
Mon, 12 Oct 2015 17:44:48 +0000 (20:44 +0300)
committerCalin Crisan <ccrisan@gmail.com>
Mon, 12 Oct 2015 17:44:48 +0000 (20:44 +0300)
motioneye/config.py
motioneye/static/js/main.js
motioneye/templates/main.html

index 69608946b5c378047f5068f6e37be56e1f277948..e81d359942803e24c5f2b8a4a83e4c42f5aba203 100644 (file)
@@ -623,7 +623,6 @@ def motion_camera_ui_to_dict(ui, old_config=None):
         # device
         '@name': ui['name'],
         '@enabled': ui['enabled'],
-        'lightswitch': ui['light_switch_detect'],
         'auto_brightness': ui['auto_brightness'],
         'framerate': int(ui['framerate']),
         'rotate': int(ui['rotation']),
@@ -673,6 +672,7 @@ def motion_camera_ui_to_dict(ui, old_config=None):
         'locate_motion_mode': ui['show_frame_changes'],
         'noise_tune': ui['auto_noise_detect'],
         'noise_level': max(1, int(round(int(ui['noise_level']) * 2.55))),
+        'lightswitch': ui['light_switch_detect'],
         'event_gap': int(ui['event_gap']),
         'pre_capture': int(ui['pre_capture']),
         'post_capture': int(ui['post_capture']),
@@ -910,7 +910,6 @@ def motion_camera_dict_to_ui(data):
         'name': data['@name'],
         'enabled': data['@enabled'],
         'id': data['@id'],
-        'light_switch_detect': data['lightswitch'],
         'auto_brightness': data['auto_brightness'],
         'framerate': int(data['framerate']),
         'rotation': int(data['rotate']),
@@ -963,6 +962,7 @@ def motion_camera_dict_to_ui(data):
         'show_frame_changes': data['text_changes'] or data['locate_motion_mode'],
         'auto_noise_detect': data['noise_tune'],
         'noise_level': int(int(data['noise_level']) / 2.55),
+        'light_switch_detect': data['lightswitch'],
         'event_gap': int(data['event_gap']),
         'pre_capture': int(data['pre_capture']),
         'post_capture': int(data['post_capture']),
@@ -1600,7 +1600,6 @@ def _set_default_motion_camera(camera_id, data):
         data.setdefault('width', 352)
         data.setdefault('height', 288)
 
-    data.setdefault('lightswitch', 50)
     data.setdefault('auto_brightness', False)
     data.setdefault('framerate', 2)
     data.setdefault('rotate', 0)
@@ -1634,6 +1633,7 @@ def _set_default_motion_camera(camera_id, data):
     data.setdefault('threshold', 2000)
     data.setdefault('noise_tune', True)
     data.setdefault('noise_level', 32)
+    data.setdefault('lightswitch', 50)
     data.setdefault('minimum_motion_frames', 1)
     
     data.setdefault('pre_capture', 2)
index c192f4e23ab60b9d7e0511c71b67150da5ba75c8..0ea284012a3df4514b4a73c0e82de19e0876be6c 100644 (file)
@@ -1274,7 +1274,6 @@ function cameraUi2Dict() {
         'proto': $('#deviceTypeEntry')[0].proto,
         
         /* video device */
-        'light_switch_detect': $('#lightSwitchDetectSlider').val(),
         'auto_brightness': $('#autoBrightnessSwitch')[0].checked,
         'rotation': $('#rotationSelect').val(),
         'framerate': $('#framerateSlider').val(),
@@ -1347,6 +1346,7 @@ function cameraUi2Dict() {
         'frame_change_threshold': $('#frameChangeThresholdSlider').val(),
         'auto_noise_detect': $('#autoNoiseDetectSwitch')[0].checked,
         'noise_level': $('#noiseLevelSlider').val(),
+        'light_switch_detect': $('#lightSwitchDetectSlider').val(),
         'event_gap': $('#eventGapEntry').val(),
         'pre_capture': $('#preCaptureEntry').val(),
         'post_capture': $('#postCaptureEntry').val(),
@@ -1503,7 +1503,6 @@ function dict2CameraUi(dict) {
     $('#deviceUrlEntry').val(dict['device_url']); markHideIfNull('device_url', 'deviceUrlEntry');
     $('#deviceTypeEntry').val(prettyType); markHideIfNull(!prettyType, 'deviceTypeEntry');
     $('#deviceTypeEntry')[0].proto = dict['proto'];
-    $('#lightSwitchDetectSlider').val(dict['light_switch_detect']); markHideIfNull('light_switch_detect', 'lightSwitchDetectSlider');
     $('#autoBrightnessSwitch')[0].checked = dict['auto_brightness']; markHideIfNull('auto_brightness', 'autoBrightnessSwitch');
     
     $('#brightnessSlider').val(dict['brightness']); markHideIfNull('brightness', 'brightnessSlider');
@@ -1655,6 +1654,7 @@ function dict2CameraUi(dict) {
     $('#frameChangeThresholdSlider').val(dict['frame_change_threshold']); markHideIfNull('frame_change_threshold', 'frameChangeThresholdSlider');
     $('#autoNoiseDetectSwitch')[0].checked = dict['auto_noise_detect']; markHideIfNull('auto_noise_detect', 'autoNoiseDetectSwitch');
     $('#noiseLevelSlider').val(dict['noise_level']); markHideIfNull('noise_level', 'noiseLevelSlider');
+    $('#lightSwitchDetectSlider').val(dict['light_switch_detect']); markHideIfNull('light_switch_detect', 'lightSwitchDetectSlider');
     $('#eventGapEntry').val(dict['event_gap']); markHideIfNull('event_gap', 'eventGapEntry');
     $('#preCaptureEntry').val(dict['pre_capture']); markHideIfNull('pre_capture', 'preCaptureEntry');
     $('#postCaptureEntry').val(dict['post_capture']); markHideIfNull('post_capture', 'postCaptureEntry');
index 1abebdde77c54818d9f92678d0541ddbbd59b26b..6ccd717868ba2bfb97cf5270bb108f8e097b1bea 100644 (file)
                         <td class="settings-item-value"><input type="checkbox" class="styled device camera-config" id="autoBrightnessSwitch"></td>
                         <td><span class="help-mark" title="enables software automatic brightness (only recommended for cameras without autobrightness)">?</span></td>
                     </tr>
-                    <tr class="settings-item advanced-setting" min="0" max="100" snap="2" ticksnum="5" decimals="0" unit="%">
-                        <td class="settings-item-label"><span class="settings-item-label">Light Switch Detection</span></td>
-                        <td class="settings-item-value"><input type="text" class="range styled device camera-config" id="lightSwitchDetectSlider"></td>
-                        <td><span class="help-mark" title="sets the percentage of the image that needs to change so that the event is treated as a sudden light change instead of motion (0% disables the function)">?</span></td>
-                    </tr>
                     <tr class="settings-item advanced-setting" min="0" max="100" snap="2" ticksnum="5" decimals="0" unit="%">
                         <td class="settings-item-label"><span class="settings-item-label">Brightness</span></td>
                         <td class="settings-item-value"><input type="text" class="range styled device camera-config" id="brightnessSlider"></td>
                         <td class="settings-item-value"><input type="text" class="range styled motion-detection camera-config" id="noiseLevelSlider"></td>
                         <td><span class="help-mark" title="manually sets the noise level to a fixed value">?</span></td>
                     </tr>
+                    <tr class="settings-item advanced-setting" min="0" max="100" snap="2" ticksnum="5" decimals="0" unit="%">
+                        <td class="settings-item-label"><span class="settings-item-label">Light Switch Detection</span></td>
+                        <td class="settings-item-value"><input type="text" class="range styled motion-detection camera-config" id="lightSwitchDetectSlider"></td>
+                        <td><span class="help-mark" title="sets the percentage of the image that needs to change so that the event is treated as a sudden light change instead of motion (0% disables the function)">?</span></td>
+                    </tr>
                     <tr class="settings-item advanced-setting">
                         <td colspan="100"><div class="settings-item-separator"></div></td>
                     </tr>