1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2025-07-04 14:24:10 +00:00

Allow disabling media autodetection at build time.

Use DINDEXER_WITH_MEDIA_AUTODETECT.
This commit is contained in:
King_DuckZ 2015-12-08 16:07:21 +00:00
parent 97de157724
commit 2cdf0cb3b9
9 changed files with 53 additions and 9 deletions

View file

@ -60,7 +60,9 @@ namespace din {
oss << ", " << g_allowed_types[z];
}
oss << '.';
#if defined(WITH_MEDIA_AUTODETECT)
oss << " Default is 'autodetect'.";
#endif
type_param_help = oss.str();
}
@ -76,7 +78,11 @@ namespace din {
po::options_description set_options("Set options");
set_options.add_options()
("setname,n", po::value<std::string>()->default_value("New set"), "Name to be given to the new set being scanned.")
#if defined(WITH_MEDIA_AUTODETECT)
("type,t", po::value<char>(), type_param_help.c_str())
#else
("type,t", po::value<char>()->default_value('V'), type_param_help.c_str())
#endif
;
po::options_description positional_options("Positional options");
positional_options.add_options()
@ -121,9 +127,15 @@ namespace din {
if (parVarMap.count("search-path") == 0) {
throw std::invalid_argument("No search path specified");
}
if (parVarMap.count("type") and g_allowed_types + lengthof(g_allowed_types) == std::find(g_allowed_types, g_allowed_types + lengthof(g_allowed_types), parVarMap["type"].as<char>())) {
#if defined(WITH_MEDIA_AUTODETECT)
if (parVarMap.count("type")) {
#endif
if (g_allowed_types + lengthof(g_allowed_types) == std::find(g_allowed_types, g_allowed_types + lengthof(g_allowed_types), parVarMap["type"].as<char>())) {
throw std::invalid_argument("Invalid value for parameter \"type\"");
}
#if defined(WITH_MEDIA_AUTODETECT)
}
#endif
return false;
}
} //namespace din