]> www.vanbest.org Git - motioneye-debian/commitdiff
still images: add "manual" capture mode
authorCalin Crisan <ccrisan@gmail.com>
Sat, 5 Aug 2017 19:39:00 +0000 (22:39 +0300)
committerCalin Crisan <ccrisan@gmail.com>
Sat, 5 Aug 2017 19:41:45 +0000 (22:41 +0300)
motioneye/config.py
motioneye/mediafiles.py
motioneye/static/js/main.js
motioneye/templates/main.html

index e7614e5a15cafb0de740984010d07c879ae9d32c..f3b1105fd4c965d7b1ecfba3d9f57ba9d144c1cb 100644 (file)
@@ -770,8 +770,8 @@ def motion_camera_ui_to_dict(ui, old_config=None):
         # still images
         'output_pictures': False,
         'snapshot_interval': 0,
-        'picture_filename': ui['image_file_name'],
-        'snapshot_filename': ui['image_file_name'],
+        'picture_filename': '',
+        'snapshot_filename': '',
         'quality': max(1, int(ui['image_quality'])),
         '@preserve_pictures': int(ui['preserve_pictures']),
         '@manual_snapshots': ui['manual_snapshots'],
@@ -940,6 +940,9 @@ def motion_camera_ui_to_dict(ui, old_config=None):
             data['text_double'] = True
 
     if ui['still_images']:
+        data['picture_filename'] = ui['image_file_name']
+        data['snapshot_filename'] = ui['image_file_name']
+
         capture_mode = ui['capture_mode']
         if capture_mode == 'motion-triggered':
             data['output_pictures'] = True
@@ -951,6 +954,10 @@ def motion_camera_ui_to_dict(ui, old_config=None):
             data['output_pictures'] = True
             data['emulate_motion'] = True
 
+        elif capture_mode == 'manual':
+            data['output_pictures'] = False
+            data['emulate_motion'] = False
+
     if ui['movies']:
         data['ffmpeg_output_movies'] = True
         recording_mode = ui['recording_mode']
@@ -1340,8 +1347,7 @@ def motion_camera_dict_to_ui(data):
     snapshot_interval = data['snapshot_interval']
     snapshot_filename = data['snapshot_filename']
 
-    ui['still_images'] = (((emulate_motion or output_pictures) and picture_filename) or
-                          (snapshot_interval and snapshot_filename))
+    ui['still_images'] = bool(snapshot_filename) or bool(picture_filename)
 
     if emulate_motion:
         ui['capture_mode'] = 'all-frames'
@@ -1359,6 +1365,11 @@ def motion_camera_dict_to_ui(data):
         if picture_filename:
             ui['image_file_name'] = picture_filename
 
+    else:  # assuming manual
+        ui['capture_mode'] = 'manual'
+        if snapshot_filename:
+            ui['image_file_name'] = snapshot_filename
+
     if data['ffmpeg_output_movies']:
         ui['movies'] = True
 
index fc7afb62291327abf2ec7539794036b366b2083a..880697ad22b3485be7cdf7ada4681db97e1cb216 100644 (file)
@@ -212,11 +212,8 @@ def cleanup_media(media_type):
         if preserve_media == 0:
             continue  # preserve forever
         
-        still_images_enabled = bool(
-                ((camera_config['emulate_motion'] or camera_config['output_pictures']) and camera_config['picture_filename']) or
-                (camera_config['snapshot_interval'] and camera_config['snapshot_filename']))
-        
-        movies_enabled = camera_config['ffmpeg_output_movies']
+        still_images_enabled = bool(camera_config['picture_filename']) or bool(camera_config['snapshot_filename'])
+        movies_enabled = bool(camera_config['ffmpeg_output_movies'])
 
         if media_type == 'picture' and not still_images_enabled:
             continue  # only cleanup pictures for cameras with still images enabled
index 1e1d6453d6e33d66257181d76ba64645e74d78ec..329bc781f2c0dcb5f7b3f3dd16a0c0223063bc1d 100644 (file)
@@ -791,7 +791,7 @@ function initUI() {
     });
     
     /* capture mode and recording mode are not completely independent:
-     * all frames capture mode implies continuous recording (and vice-versa) */
+     * all-frames capture mode implies continuous recording (and vice-versa) */
     $('#captureModeSelect').change(function (val) {
         if ($('#captureModeSelect').val() == 'all-frames') {
             $('#recordingModeSelect').val('continuous');
index cf802911fec8dbb6390168049838d68a908755b3..46a5af5e679abc4a8cde151ef3779455d721ff6e 100644 (file)
                                 <option value="motion-triggered">Motion Triggered</option>
                                 <option value="interval-snapshots">Interval Snapshots</option>
                                 <option value="all-frames">All Frames</option>
+                                <option value="manual">Manual</option>
                             </select>
                         </td>
-                        <td><span class="help-mark" title="sets the image capture mode: Motion Triggered = an image captured whenever motion is detected, Interval Snapshots = an image captured every x seconds, All Frames = saves each frame to an image file">?</span></td>
+                        <td><span class="help-mark" title="sets the image capture mode:
+                                Motion Triggered = an image captured whenever motion is detected,
+                                Interval Snapshots = an image captured every x seconds,
+                                All Frames = saves each frame to an image file,
+                                Manual = manual snapshots using snapshot button">?</span></td>
                     </tr>
                     <tr class="settings-item advanced-setting" min="1" max="86400" required="true" depends="captureMode=interval-snapshots">
                         <td class="settings-item-label"><span class="settings-item-label">Snapshot Interval</span></td>