From: Calin Crisan <ccrisan@gmail.com>
Date: Mon, 12 Sep 2016 19:42:24 +0000 (+0300)
Subject: onyl smart and editable mask types will be supported
X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=12caf28627ee4a26490b4e85e630012cd3ecaa4e;p=motioneye-debian

onyl smart and editable mask types will be supported
---

diff --git a/motioneye/config.py b/motioneye/config.py
index 4b82ad9..b3684f0 100644
--- a/motioneye/config.py
+++ b/motioneye/config.py
@@ -875,9 +875,6 @@ def motion_camera_ui_to_dict(ui, old_config=None):
         elif ui['mask_type'] == 'editable':
             data['mask_file'] = utils.build_editable_mask_file(ui['editable_mask'])
 
-        else:
-            data['mask_file'] = ui['mask_file']
-
     # working schedule
     if ui['working_schedule']:
         data['@working_schedule'] = (
@@ -1060,7 +1057,6 @@ def motion_camera_dict_to_ui(data):
         'mask': False,
         'mask_type': 'smart',
         'smart_mask_slugginess': 5,
-        'mask_file': '',
         'editable_mask': '',
         
         # motion notifications
@@ -1245,6 +1241,17 @@ def motion_camera_dict_to_ui(data):
 
     ui['movie_quality'] = int(q)
 
+    # mask
+    if data['mask_file']:
+        ui['mask'] = True
+        ui['mask_type'] = 'editable'
+        ui['editable_mask'] = utils.parse_editable_mask_file(data['mask_file'])
+
+    elif data['smart_mask_speed']:
+        ui['mask'] = True
+        ui['mask_type'] = 'smart'
+        ui['smart_mask_slugginess'] = 10 - data['smart_mask_speed']
+
     # working schedule
     working_schedule = data['@working_schedule']
     if working_schedule:
diff --git a/motioneye/templates/main.html b/motioneye/templates/main.html
index 20df1ef..9b579e3 100644
--- a/motioneye/templates/main.html
+++ b/motioneye/templates/main.html
@@ -826,21 +826,15 @@
                             <select class="styled motion-detection camera-config" id="maskTypeSelect">
                                 <option value="smart">Smart</option>
                                 <option value="editable">Editable</option>
-                                <option value="file">File</option>
                             </select>
                         </td>
-                        <td><span class="help-mark" title="the smart option automatically detects regions with regular motion and builds an internal mask, the editable mask allows you to manually build it and the file option allows you to specify a mask file (not recommended)">?</span></td>
+                        <td><span class="help-mark" title="the smart option automatically detects regions with regular motion and dynamically builds an internal mask, while the editable mask allows you to manually build it yourself">?</span></td>
                     </tr>
                     <tr class="settings-item advanced-setting" min="1" max="10" snap="1" ticksnum="10" decimals="0" unit="" depends="mask maskType=smart">
                         <td class="settings-item-label"><span class="settings-item-label">Smart Mask Slugginess</span></td>
                         <td class="settings-item-value"><input type="text" class="range styled motion-detection camera-config" id="smartMaskSlugginessSlider"></td>
                         <td><span class="help-mark" title="lower values result in a longer-lasting smart mask with a slower building process">?</span></td>
                     </tr>
-                    <tr class="settings-item advanced-setting" required="true" depends="mask maskType=file" strip="true">
-                        <td class="settings-item-label"><span class="settings-item-label">Mask File</span></td>
-                        <td class="settings-item-value"><input type="text" class="styled motion-detection camera-config" id="maskFileEntry"></td>
-                        <td><span class="help-mark" title="full path to the PGM mask image file">?</span></td>
-                    </tr>
                     {% for config in camera_sections.get('motion-detection', {}).get('configs', []) %}
                         {{config_item(config)}}
                     {% endfor %}