From: Jeff Lawson Date: Tue, 19 Apr 2016 06:57:36 +0000 (-0500) Subject: add checkboxes to individually control upload of pictures vs videos X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=81a0bafd369d2abf4299845e1f23e1becfb0ef32;p=motioneye-debian add checkboxes to individually control upload of pictures vs videos --- diff --git a/motioneye/config.py b/motioneye/config.py index 97b8a9c..15cde84 100644 --- a/motioneye/config.py +++ b/motioneye/config.py @@ -635,6 +635,8 @@ def motion_camera_ui_to_dict(ui, old_config=None): '@network_username': ui['network_username'], '@network_password': ui['network_password'], '@upload_enabled': ui['upload_enabled'], + '@upload_movie': ui['upload_movie'], + '@upload_picture': ui['upload_picture'], '@upload_service': ui['upload_service'], '@upload_server': ui['upload_server'], '@upload_port': ui['upload_port'], @@ -973,6 +975,8 @@ def motion_camera_dict_to_ui(data): 'disk_total': 0, 'available_disks': diskctl.list_mounted_disks(), 'upload_enabled': data['@upload_enabled'], + 'upload_picture': data['@upload_picture'], + 'upload_movie': data['@upload_movie'], 'upload_service': data['@upload_service'], 'upload_server': data['@upload_server'], 'upload_port': data['@upload_port'], @@ -1726,6 +1730,8 @@ def _set_default_motion_camera(camera_id, data): data.setdefault('@network_password', '') data.setdefault('target_dir', settings.MEDIA_PATH) data.setdefault('@upload_enabled', False) + data.setdefault('@upload_picture', True) + data.setdefault('@upload_movie', True) data.setdefault('@upload_service', 'ftp') data.setdefault('@upload_server', '') data.setdefault('@upload_port', '') diff --git a/motioneye/handlers.py b/motioneye/handlers.py index 5384a9f..0f38e90 100644 --- a/motioneye/handlers.py +++ b/motioneye/handlers.py @@ -1578,14 +1578,14 @@ class RelayEventHandler(BaseHandler): camera_config=camera_config, full_path=filename) # upload to external service - if camera_config['@upload_enabled']: + if camera_config['@upload_enabled'] and camera_config['@upload_movie']: self.upload_media_file(filename, camera_id, camera_config) elif event == 'picture_save': filename = self.get_argument('filename') # upload to external service - if camera_config['@upload_enabled']: + if camera_config['@upload_enabled'] and camera_config['@upload_picture']: self.upload_media_file(filename, camera_id, camera_config) else: diff --git a/motioneye/static/js/main.js b/motioneye/static/js/main.js index 2d7da7c..f1fc9f0 100644 --- a/motioneye/static/js/main.js +++ b/motioneye/static/js/main.js @@ -1486,6 +1486,8 @@ function cameraUi2Dict() { 'network_password': $('#networkPasswordEntry').val(), 'root_directory': $('#rootDirectoryEntry').val(), 'upload_enabled': $('#uploadEnabledSwitch')[0].checked, + 'upload_picture': $('#uploadPictureSwitch')[0].checked, + 'upload_movie': $('#uploadMovieSwitch')[0].checked, 'upload_service': $('#uploadServiceSelect').val(), 'upload_server': $('#uploadServerEntry').val(), 'upload_port': $('#uploadPortEntry').val(), @@ -1779,6 +1781,8 @@ function dict2CameraUi(dict) { }); markHideIfNull('disk_used', 'diskUsageProgressBar'); $('#uploadEnabledSwitch')[0].checked = dict['upload_enabled']; markHideIfNull('upload_enabled', 'uploadEnabledSwitch'); + $('#uploadPictureSwitch')[0].checked = dict['upload_picture']; markHideIfNull('upload_picture', 'uploadPictureSwitch'); + $('#uploadMovieSwitch')[0].checked = dict['upload_movie']; markHideIfNull('upload_movie', 'uploadMovieSwitch'); $('#uploadServiceSelect').val(dict['upload_service']); markHideIfNull('upload_service', 'uploadServiceSelect'); $('#uploadServerEntry').val(dict['upload_server']); markHideIfNull('upload_server', 'uploadServerEntry'); $('#uploadPortEntry').val(dict['upload_port']); markHideIfNull('upload_port', 'uploadPortEntry'); diff --git a/motioneye/templates/main.html b/motioneye/templates/main.html index c994a81..a35d570 100644 --- a/motioneye/templates/main.html +++ b/motioneye/templates/main.html @@ -370,6 +370,16 @@ ? + + Upload Pictures + + ? + + + Upload Movies + + ? + Upload Service