Improvements to the camera_dir config option

- The `camera_dir` option was always being set to a default path
which was missing a 'motion/' compared to the installed config
file default. This caused it to always check that folder and
upon a Web config-write, to always write out as enabled.
We now set it NULL like most other options and read the config
value into it, if enabled.
- Upon a Web config-write if the option is disabled, we now write
out the installed default path with it (remaining disabled).
- Improved the guide and config help to be more clear of how the
option works.
This commit is contained in:
genius3000
2017-08-01 01:23:06 -06:00
parent 6f881cf420
commit 3af03ad642
3 changed files with 18 additions and 7 deletions

15
conf.c
View File

@@ -155,7 +155,7 @@ struct config conf_template = {
.log_file = NULL,
.log_level = LEVEL_DEFAULT+10,
.log_type_str = NULL,
.camera_dir = sysconfdir"/conf.d"
.camera_dir = NULL
};
@@ -1608,7 +1608,9 @@ config_param config_params[] = {
{
"camera_dir",
"\n##############################################################\n"
"# Camera config directory - One for each camera.\n"
"# Camera config directory\n"
"# Any files ending in '.conf' in this directory will be read\n"
"# as a camera config file.\n"
"##############################################################\n",
1,
CONF_OFFSET(camera_dir),
@@ -1887,8 +1889,13 @@ void conf_print(struct context **cnt)
free(val);
} else if (thread == 0) {
/* The 'camera_dir' option should keep the installed default value */
val = "value";
if (!strncmp(config_params[i].param_name, "camera_dir", 10))
val = sysconfdir"/motion/conf.d";
fprintf(conffile, "%s\n", config_params[i].param_help);
fprintf(conffile, "; %s value\n\n", config_params[i].param_name);
fprintf(conffile, "; %s %s\n\n", config_params[i].param_name, val);
}
}
}
@@ -2400,7 +2407,7 @@ static const char *print_camera(struct context **cnt, char **str,
/**
* config_camera_dir
* Read the directory finding all *.conf files in the path
* when calls config_camera
* When found calls config_camera
*/
static struct context **read_camera_dir(struct context **cnt, const char *str,

View File

@@ -746,7 +746,9 @@ quiet on
##############################################################
# Camera config directory - One for each camera.
# Camera config directory
# Any files ending in '.conf' in this directory will be read
# as a camera config file.
##############################################################
#
; camera_dir @sysconfdir@/motion/conf.d

View File

@@ -2560,7 +2560,9 @@ specifiers as well as on the web interface.
<li> Default: </li>
</ul>
<p></p>
This option specifies a alternative directory to contain the individual camera configuration files.
This option specifies a directory to contain the individual camera configuration files.
Any files ending in '.conf' in this directory will be read as a camera config file.
Disable a camera (config file) by renaming it so it does not end with '.conf'.
<p></p>
<p></p>