From d7c5f36aef9b316c8373504ed0a7e19c9a5c8190 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Tue, 13 Sep 2016 21:53:09 +0300 Subject: [PATCH] prevented error in log file when adding a camera with inexistent target directory --- motioneye/config.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/motioneye/config.py b/motioneye/config.py index bfbafec..4be2fb5 100644 --- a/motioneye/config.py +++ b/motioneye/config.py @@ -786,6 +786,7 @@ def motion_camera_ui_to_dict(ui, old_config=None): # try to create the target dir try: os.makedirs(data['target_dir']) + logging.debug('created root directory %s for camera %s' % (data['target_dir'], data['@name'])) except Exception as e: if isinstance(e, OSError) and e.errno == errno.EEXIST: @@ -1146,10 +1147,12 @@ def motion_camera_dict_to_ui(data): ui['root_directory'] = data['target_dir'] # disk usage - usage = utils.get_disk_usage(data['target_dir']) + usage = None + if os.path.exists(data['target_dir']): + usage = utils.get_disk_usage(data['target_dir']) if usage: ui['disk_used'], ui['disk_total'] = usage - + text_left = data['text_left'] text_right = data['text_right'] if text_left or text_right: -- 2.39.5