sys.path.append(os.path.join(getattr(settings, 'PROJECT_PATH', os.path.dirname(sys.argv[0])), 'src'))
-import smbctl
-
VERSION = '0.12'
if __name__ == '__main__':
cmd = _configure_settings()
+ import smbctl
+
if not _test_requirements():
sys.exit(-1)
mounts = []
for camera in cameras:
- if camera['@storage_device'] != 'network-share':
+ if camera.get('@storage_device') != 'network-share':
continue
mounts.append({
set_main(main_config)
- # try to create the target_dir
- try:
- os.makedirs(camera_config['target_dir'])
-
- except OSError as e:
- if e.errno != errno.EEXIST:
- logging.warn('failed to create target directory: %(msg)s' % {'msg': unicode(e)})
-
# read the actual configuration from file
config_file_path = os.path.join(settings.CONF_PATH, _CAMERA_CONFIG_FILE_NAME) % {'id': camera_id}
if os.path.isfile(config_file_path):
should_start = False
# unmount the no longer necessary mounts
- for (network_share['server'], network_share['share'], network_share['username']), required in mounts.items():
+ for (server, share, username), required in mounts.items():
if not required:
- umount(network_share['server'], network_share['share'], network_share['username'])
+ umount(server, share, username)
should_stop = True
return (should_stop, should_start)
/* file storage */
$('#storageDeviceSelect').empty();
dict['available_disks'] = dict['available_disks'] || [];
- var storageDeviceOptions = {};
+ var storageDeviceOptions = {'network-share': true};
dict['available_disks'].forEach(function (disk) {
disk.partitions.forEach(function (partition) {
var target = partition.target.replaceAll('/', '-');