Processing a directory now look for image format set in options (#3691)
See the updated '-c' and new '-a' help when using rawtherapee-cli.exe -h
This commit is contained in:
parent
cf47cdee2d
commit
bcad76cd5e
@ -298,6 +298,7 @@ int processLineParams( int argc, char **argv )
|
|||||||
bool sideProcParams = false;
|
bool sideProcParams = false;
|
||||||
bool copyParamsFile = false;
|
bool copyParamsFile = false;
|
||||||
bool skipIfNoSidecar = false;
|
bool skipIfNoSidecar = false;
|
||||||
|
bool allExtensions = false;
|
||||||
bool useDefault = false;
|
bool useDefault = false;
|
||||||
unsigned int sideCarFilePos = 0;
|
unsigned int sideCarFilePos = 0;
|
||||||
int compression = 92;
|
int compression = 92;
|
||||||
@ -378,6 +379,10 @@ int processLineParams( int argc, char **argv )
|
|||||||
overwriteFiles = true;
|
overwriteFiles = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'a':
|
||||||
|
allExtensions = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'j':
|
case 'j':
|
||||||
if (currParam.length() > 2 && currParam.at(2) == 's') {
|
if (currParam.length() > 2 && currParam.at(2) == 's') {
|
||||||
if (currParam.length() == 3) {
|
if (currParam.length() == 3) {
|
||||||
@ -431,7 +436,7 @@ int processLineParams( int argc, char **argv )
|
|||||||
case 'f':
|
case 'f':
|
||||||
fast_export = true;
|
fast_export = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c': // MUST be last option
|
case 'c': // MUST be last option
|
||||||
while (iArg + 1 < argc) {
|
while (iArg + 1 < argc) {
|
||||||
iArg++;
|
iArg++;
|
||||||
@ -440,11 +445,28 @@ int processLineParams( int argc, char **argv )
|
|||||||
argument = argument.substr(1, argument.length()-2);
|
argument = argument.substr(1, argument.length()-2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Glib::file_test (argument, Glib::FILE_TEST_IS_REGULAR)) {
|
if (!Glib::file_test (argument, Glib::FILE_TEST_EXISTS)) {
|
||||||
inputFiles.emplace_back (argument);
|
std::cout << "\"" << argument << "\" doesn't exist !" << std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Glib::file_test (argument, Glib::FILE_TEST_IS_REGULAR)) {
|
||||||
|
bool notAll = allExtensions && !options.is_parse_extention (argument);
|
||||||
|
bool notRetained = !allExtensions && !options.has_retained_extention (argument);
|
||||||
|
if (notAll || notRetained) {
|
||||||
|
if (notAll) {
|
||||||
|
std::cout << "\"" << argument << "\" is not one of the file format to process: skipped" << std::endl;
|
||||||
|
} else if (notRetained) {
|
||||||
|
std::cout << "\"" << argument << "\" is not one of the retained file format to process: skipped" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
inputFiles.emplace_back (argument);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (Glib::file_test (argument, Glib::FILE_TEST_IS_DIR)) {
|
if (Glib::file_test (argument, Glib::FILE_TEST_IS_DIR)) {
|
||||||
|
|
||||||
auto dir = Gio::File::create_for_path (argument);
|
auto dir = Gio::File::create_for_path (argument);
|
||||||
@ -459,19 +481,28 @@ int processLineParams( int argc, char **argv )
|
|||||||
while (auto file = enumerator->next_file ()) {
|
while (auto file = enumerator->next_file ()) {
|
||||||
|
|
||||||
const auto fileName = Glib::build_filename (argument, file->get_name ());
|
const auto fileName = Glib::build_filename (argument, file->get_name ());
|
||||||
|
bool isDir = Glib::file_test (fileName, Glib::FILE_TEST_IS_DIR);
|
||||||
|
bool notAll = allExtensions && !options.is_parse_extention (fileName);
|
||||||
|
bool notRetained = !allExtensions && !options.has_retained_extention (fileName);
|
||||||
|
|
||||||
if (Glib::file_test (fileName, Glib::FILE_TEST_IS_DIR)) {
|
if (isDir || notAll || notRetained) {
|
||||||
|
if (isDir) {
|
||||||
|
std::cout << "\"" << fileName << "\" is a directory: skipped" << std::endl;
|
||||||
|
} else if (notAll) {
|
||||||
|
std::cout << "\"" << fileName << "\" is not one of the file format to process: skipped" << std::endl;
|
||||||
|
} else if (notRetained) {
|
||||||
|
std::cout << "\"" << fileName << "\" is not one of the retained file format to process: skipped" << std::endl;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip files without extension and sidecar files
|
if (sideProcParams && skipIfNoSidecar) {
|
||||||
auto lastdot = fileName.find_last_of('.');
|
// look for the sidecar proc params
|
||||||
if (lastdot == Glib::ustring::npos) {
|
if (!Glib::file_test(fileName + paramFileExtension, Glib::FILE_TEST_EXISTS)) {
|
||||||
continue;
|
std::cout << "\"" << fileName << "\" has no side-car file: image skipped" << std::endl;
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
if (fileName.substr (lastdot).compare (paramFileExtension) == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inputFiles.emplace_back (fileName);
|
inputFiles.emplace_back (fileName);
|
||||||
@ -521,12 +552,16 @@ int processLineParams( int argc, char **argv )
|
|||||||
std::cout << " " << Glib::path_get_basename(argv[0]) << " [-o <output>|-O <output>] [-s|-S] [-p <one.pp3> [-p <two.pp3> ...] ] [-d] [ -j[1-100] [-js<1-3>] | [-b<8|16>] [-t[z] | [-n]] ] [-Y] [-f] -c <input>" << std::endl;
|
std::cout << " " << Glib::path_get_basename(argv[0]) << " [-o <output>|-O <output>] [-s|-S] [-p <one.pp3> [-p <two.pp3> ...] ] [-d] [ -j[1-100] [-js<1-3>] | [-b<8|16>] [-t[z] | [-n]] ] [-Y] [-f] -c <input>" << std::endl;
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
std::cout << " -q Quick Start mode : do not load cached files to speedup start time." << std::endl;
|
std::cout << " -q Quick Start mode : do not load cached files to speedup start time." << std::endl;
|
||||||
std::cout << " -c <files> Specify one or more input files." << std::endl;
|
std::cout << " -c <files> Specify one or more input files or directory." << std::endl;
|
||||||
|
std::cout << " When specifying directories, Rawtherapee will look for images files that comply with the" << std::endl;
|
||||||
|
std::cout << " selected extensions (see also '-a')." << std::endl;
|
||||||
std::cout << " -c must be the last option." << std::endl;
|
std::cout << " -c must be the last option." << std::endl;
|
||||||
std::cout << " -o <file>|<dir> Set output file or folder." << std::endl;
|
std::cout << " -o <file>|<dir> Set output file or folder." << std::endl;
|
||||||
std::cout << " Saves output file alongside input file if -o is not specified." << std::endl;
|
std::cout << " Saves output file alongside input file if -o is not specified." << std::endl;
|
||||||
std::cout << " -O <file>|<dir> Set output file or folder and copy " << pparamsExt << " file into it." << std::endl;
|
std::cout << " -O <file>|<dir> Set output file or folder and copy " << pparamsExt << " file into it." << std::endl;
|
||||||
std::cout << " Saves output file alongside input file if -O is not specified." << std::endl;
|
std::cout << " Saves output file alongside input file if -O is not specified." << std::endl;
|
||||||
|
std::cout << " -a stand for 'all'. When specifying a directory, process all images specified in the" << std::endl;
|
||||||
|
std::cout << " extension list from the options file, even those currently not seleted" << std::endl;
|
||||||
std::cout << " -s Use the existing sidecar file to build the processing parameters," << std::endl;
|
std::cout << " -s Use the existing sidecar file to build the processing parameters," << std::endl;
|
||||||
std::cout << " e.g. for photo.raw there should be a photo.raw." << pparamsExt << " file in the same folder." << std::endl;
|
std::cout << " e.g. for photo.raw there should be a photo.raw." << pparamsExt << " file in the same folder." << std::endl;
|
||||||
std::cout << " If the sidecar file does not exist, neutral values will be used." << std::endl;
|
std::cout << " If the sidecar file does not exist, neutral values will be used." << std::endl;
|
||||||
|
@ -2365,6 +2365,27 @@ void Options::save ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* return true if ext is a parsed extension (retained or not)
|
||||||
|
*/
|
||||||
|
bool Options::is_parse_extention (Glib::ustring fname)
|
||||||
|
{
|
||||||
|
Glib::ustring ext = getExtension (fname).lowercase();
|
||||||
|
|
||||||
|
if (!ext.empty()) {
|
||||||
|
// there is an extension to the filename
|
||||||
|
|
||||||
|
// look out if it has one of the listed extensions (selected or not)
|
||||||
|
for (unsigned int i = 0; i < parseExtensions.size(); i++) {
|
||||||
|
if (ext == parseExtensions[i]) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* return true if fname ends with one of the retained image file extensions
|
* return true if fname ends with one of the retained image file extensions
|
||||||
*/
|
*/
|
||||||
|
@ -333,6 +333,7 @@ public:
|
|||||||
return globalProfilePath;
|
return globalProfilePath;
|
||||||
}
|
}
|
||||||
Glib::ustring findProfilePath(Glib::ustring &profName);
|
Glib::ustring findProfilePath(Glib::ustring &profName);
|
||||||
|
bool is_parse_extention (Glib::ustring fname);
|
||||||
bool has_retained_extention (Glib::ustring fname);
|
bool has_retained_extention (Glib::ustring fname);
|
||||||
bool is_extention_enabled(Glib::ustring ext);
|
bool is_extention_enabled(Glib::ustring ext);
|
||||||
bool is_defProfRawMissing()
|
bool is_defProfRawMissing()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user