From: Calin Crisan Date: Sat, 5 Aug 2017 19:39:00 +0000 (+0300) Subject: still images: add "manual" capture mode X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=f79dc51fc7a4a8ad7f6fdac4261abd0db1fe0287;p=motioneye-debian still images: add "manual" capture mode --- diff --git a/motioneye/config.py b/motioneye/config.py index e7614e5..f3b1105 100644 --- a/motioneye/config.py +++ b/motioneye/config.py @@ -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 diff --git a/motioneye/mediafiles.py b/motioneye/mediafiles.py index fc7afb6..880697a 100644 --- a/motioneye/mediafiles.py +++ b/motioneye/mediafiles.py @@ -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 diff --git a/motioneye/static/js/main.js b/motioneye/static/js/main.js index 1e1d645..329bc78 100644 --- a/motioneye/static/js/main.js +++ b/motioneye/static/js/main.js @@ -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'); diff --git a/motioneye/templates/main.html b/motioneye/templates/main.html index cf80291..46a5af5 100644 --- a/motioneye/templates/main.html +++ b/motioneye/templates/main.html @@ -693,9 +693,14 @@ + - ? + ? Snapshot Interval