From dbfa8a3bc218a80e15f202c2b556ec94f63d8549 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sun, 26 Jul 2015 21:32:56 +0300 Subject: [PATCH] fixed a bug where extra motion options could not be removed --- motioneye.py | 2 +- src/config.py | 26 +++++++++++++++----------- static/css/ui.css | 1 + 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/motioneye.py b/motioneye.py index 1beb6ec..3dbde2d 100755 --- a/motioneye.py +++ b/motioneye.py @@ -39,7 +39,7 @@ sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), 'src')) import settings import update -VERSION = '0.24' +VERSION = '0.25.1' def _configure_settings(): diff --git a/src/config.py b/src/config.py index 4772108..d941ebb 100644 --- a/src/config.py +++ b/src/config.py @@ -52,6 +52,16 @@ _additional_structure_cache = {} # starting with r490 motion config directives have changed a bit _LAST_OLD_CONFIG_VERSIONS = (490, '3.2.12') +_KNOWN_MOTION_OPTIONS = set([ + 'auto_brightness', 'brightness', 'contrast', 'emulate_motion', 'event_gap', 'ffmpeg_bps', 'ffmpeg_output_movies', 'ffmpeg_variable_bitrate', 'ffmpeg_video_codec', + 'framerate', 'height', 'hue', 'lightswitch', 'locate_motion_mode', 'locate_motion_style', 'minimum_motion_frames', 'movie_filename', 'max_movie_time', 'max_mpeg_time', + 'noise_level', 'noise_tune', 'on_event_end', 'on_event_start', 'output_pictures', 'picture_filename', 'post_capture', 'pre_capture', 'quality', 'rotate', 'saturation', + 'snapshot_filename', 'snapshot_interval', 'stream_auth_method', 'stream_authentication', 'stream_localhost', 'stream_maxrate', 'stream_motion', 'stream_port', 'stream_quality', + 'target_dir', 'text_changes', 'text_double', 'text_left', 'text_right', 'threshold', 'videodevice', 'width', + 'webcam_localhost', 'webcam_port', 'webcam_maxrate', 'webcam_quality', 'webcam_motion', 'ffmpeg_cap_new', 'output_normal', 'output_motion', 'jpeg_filename', 'output_all', 'gap', 'locate', + 'netcam_url', 'netcam_userpass', 'netcam_http', 'netcam_tolerant_check', 'netcam_keepalive' +]) + def additional_section(func): _additional_section_funcs.append(func) @@ -854,6 +864,10 @@ def motion_camera_ui_to_dict(ui, old_config=None): data['@' + name] = value # extra motion options + for name in old_config.keys(): + if name not in _KNOWN_MOTION_OPTIONS and not name.startswith('@'): + old_config.pop(name) + extra_options = ui.get('extra_options', []) for name, value in extra_options: data[name] = value or '' @@ -1158,19 +1172,9 @@ def motion_camera_dict_to_ui(data): ui[name[1:]] = value # extra motion options - known_options = set([ - 'auto_brightness', 'brightness', 'contrast', 'emulate_motion', 'event_gap', 'ffmpeg_bps', 'ffmpeg_output_movies', 'ffmpeg_variable_bitrate', 'ffmpeg_video_codec', - 'framerate', 'height', 'hue', 'lightswitch', 'locate_motion_mode', 'locate_motion_style', 'minimum_motion_frames', 'movie_filename', 'max_movie_time', 'max_mpeg_time', - 'noise_level', 'noise_tune', 'on_event_end', 'on_event_start', 'output_pictures', 'picture_filename', 'post_capture', 'pre_capture', 'quality', 'rotate', 'saturation', - 'snapshot_filename', 'snapshot_interval', 'stream_auth_method', 'stream_authentication', 'stream_localhost', 'stream_maxrate', 'stream_motion', 'stream_port', 'stream_quality', - 'target_dir', 'text_changes', 'text_double', 'text_left', 'text_right', 'threshold', 'videodevice', 'width', - 'webcam_localhost', 'webcam_port', 'webcam_maxrate', 'webcam_quality', 'webcam_motion', 'ffmpeg_cap_new', 'output_normal', 'output_motion', 'jpeg_filename', 'output_all', 'gap', 'locate', - 'netcam_url', 'netcam_userpass', 'netcam_http', 'netcam_tolerant_check', 'netcam_keepalive' - ]) - extra_options = [] for name, value in data.iteritems(): - if name not in known_options and not name.startswith('@'): + if name not in _KNOWN_MOTION_OPTIONS and not name.startswith('@'): extra_options.append((name, value)) ui['extra_options'] = extra_options diff --git a/static/css/ui.css b/static/css/ui.css index e3eb78c..7c77c83 100644 --- a/static/css/ui.css +++ b/static/css/ui.css @@ -144,6 +144,7 @@ textarea.styled { transition: all 0.1s ease; resize: none; vertical-align: middle; + white-space: nowrap; } input[type=password].styled:FOCUS, -- 2.39.5