]> www.vanbest.org Git - motioneye-debian/commitdiff
target dir is now created if it doesn't exist upon saving the settings
authorCalin Crisan <ccrisan@gmail.com>
Thu, 14 Nov 2013 13:33:50 +0000 (15:33 +0200)
committerCalin Crisan <ccrisan@gmail.com>
Thu, 14 Nov 2013 13:33:50 +0000 (15:33 +0200)
doc/todo.txt
src/config.py
static/js/main.js

index ca23fecef7ae5b09009c7cb1d9ddc6b5c8436747..0b11b32e0869be82877f6bda776f04ffb695c31d 100644 (file)
@@ -1,4 +1,6 @@
 -> add support for picture resizing
+-> add a loading progress for media previews
+-> add a pager for media files
 -> add a download option in media list
 -> add a previewer for movies
 -> make camera frames positions configurable
index 657ba3a5d0b8bf45f8433961761dff94c2c109b7..d53d77f82f5b9a78ba9bdd62f963d760e451be9e 100644 (file)
@@ -250,12 +250,19 @@ def set_camera(camera_id, data):
                 
         elif not data['@enabled']:
             threads = [t for t in threads if t != config_file_name]
-    
+
         main_config['thread'] = threads
         
         data['@id'] = camera_id
         
         set_main(main_config)
+        
+        # try to create the target_dir
+        try:
+            os.makedirs(data['target_dir'])
+        
+        except Exception as e:
+            logging.warn('failed to create target directory: %(msg)s' % {'msg': unicode(e)})
 
     # read the actual configuration from file
     config_file_path = _CAMERA_CONFIG_FILE_PATH % {'id': camera_id}
@@ -561,7 +568,12 @@ def camera_ui_to_dict(ui):
 def camera_dict_to_ui(data):
     if data['@proto'] == 'v4l2':
         device_uri = data['videodevice']
-        disk_used, disk_total = utils.get_disk_usage(data['target_dir'])
+        usage = utils.get_disk_usage(data['target_dir'])
+        if usage:
+            disk_used, disk_total = usage
+        
+        else:
+            disk_used, disk_total = 0, 0
     
     else:
         device_uri = '%(host)s:%(port)s/config/%(camera_id)s' % {
index e58c674fd82577ee8f428c4484fa1e581d87795b..29731905b2dee9026707413f475e1dba4263e42f 100644 (file)
@@ -621,7 +621,10 @@ function dict2CameraUi(dict) {
     $('#networkUsernameEntry').val(dict['network_username']);
     $('#networkPasswordEntry').val(dict['network_password']);
     $('#rootDirectoryEntry').val(dict['root_directory']);
-    var percent = parseInt(dict['disk_used'] * 100 / dict['disk_total']);
+    var percent = 0;
+    if (dict['disk_total'] != 0) {
+        percent = parseInt(dict['disk_used'] * 100 / dict['disk_total']);
+    }
     $('#diskUsageBarFill').css('width', percent + '%');
     $('#diskUsageText').html(
             (dict['disk_used'] / 1073741824).toFixed(1)  + '/' + (dict['disk_total'] / 1073741824).toFixed(1) + ' GB (' + percent + '%)');