-> 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
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}
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' % {
$('#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 + '%)');