Allow specifying `--validate` flag when displaying file info

This commit is contained in:
Martchus 2021-08-18 23:12:27 +02:00
parent cc551d4a83
commit fef97aa1db
4 changed files with 12 additions and 8 deletions

View File

@ -13,8 +13,8 @@ set(META_APP_DESCRIPTION
set(META_GUI_OPTIONAL true)
set(META_JS_SRC_DIR renamingutility)
set(META_VERSION_MAJOR 3)
set(META_VERSION_MINOR 4)
set(META_VERSION_PATCH 3)
set(META_VERSION_MINOR 5)
set(META_VERSION_PATCH 0)
set(META_ADD_DEFAULT_CPP_UNIT_TEST_APPLICATION ON)
# add project files

View File

@ -164,9 +164,11 @@ int main(int argc, char *argv[])
OperationArgument printFieldNamesArg("print-field-names", '\0', "lists available field names, track attribute names and modifier");
printFieldNamesArg.setCallback(Cli::printFieldNames);
// display general file info
ConfigValueArgument validateArg(
"validate", 'c', "validates the file integrity as accurately as possible; the structure of the file will be parsed completely");
OperationArgument displayFileInfoArg("info", 'i', "displays general file information", PROJECT_NAME " info -f /some/dir/*.m4a");
displayFileInfoArg.setCallback(std::bind(Cli::displayFileInfo, _1, std::cref(filesArg), std::cref(verboseArg)));
displayFileInfoArg.setSubArguments({ &filesArg, &verboseArg });
displayFileInfoArg.setCallback(std::bind(Cli::displayFileInfo, _1, std::cref(filesArg), std::cref(verboseArg), std::cref(validateArg)));
displayFileInfoArg.setSubArguments({ &filesArg, &validateArg, &verboseArg });
// display tag info
ConfigValueArgument fieldsArg("fields", 'n', "specifies the field names to be displayed", { "title", "album", "artist", "trackpos" });
fieldsArg.setRequiredValueCount(Argument::varValueCount);
@ -197,8 +199,6 @@ int main(int argc, char *argv[])
exportArg.setSubArguments({ &filesArg, &prettyArg });
exportArg.setCallback(std::bind(Cli::exportToJson, _1, std::cref(filesArg), std::cref(prettyArg)));
// file info
ConfigValueArgument validateArg(
"validate", 'c', "validates the file integrity as accurately as possible; the structure of the file will be parsed completely");
OperationArgument genInfoArg("html-info", '\0', "generates technical information about the specified file as HTML document");
genInfoArg.setSubArguments({ &fileArg, &validateArg, &outputFileArg });
genInfoArg.setCallback(std::bind(Cli::generateFileInfo, _1, std::cref(fileArg), std::cref(outputFileArg), std::cref(validateArg)));

View File

@ -149,7 +149,7 @@ void generateFileInfo(const ArgumentOccurrence &, const Argument &inputFileArg,
#endif
}
void displayFileInfo(const ArgumentOccurrence &, const Argument &filesArg, const Argument &verboseArg)
void displayFileInfo(const ArgumentOccurrence &, const Argument &filesArg, const Argument &verboseArg, const Argument &validateArg)
{
CMD_UTILS_START_CONSOLE;
@ -165,6 +165,9 @@ void displayFileInfo(const ArgumentOccurrence &, const Argument &filesArg, const
AbortableProgressFeedback progress; // FIXME: actually use the progress object
try {
// parse tags
if (validateArg.isPresent()) {
fileInfo.setForceFullParse(true);
}
fileInfo.setPath(std::string(file));
fileInfo.open(true);
fileInfo.parseContainerFormat(diag, progress);

View File

@ -51,7 +51,8 @@ extern const char *const fieldNames;
extern const char *const fieldNamesForSet;
void applyGeneralConfig(const CppUtilities::Argument &timeSapnFormatArg);
void printFieldNames(const CppUtilities::ArgumentOccurrence &occurrence);
void displayFileInfo(const CppUtilities::ArgumentOccurrence &, const CppUtilities::Argument &filesArg, const CppUtilities::Argument &verboseArg);
void displayFileInfo(const CppUtilities::ArgumentOccurrence &, const CppUtilities::Argument &filesArg, const CppUtilities::Argument &verboseArg,
const CppUtilities::Argument &validateArg);
void generateFileInfo(const CppUtilities::ArgumentOccurrence &, const CppUtilities::Argument &inputFileArg,
const CppUtilities::Argument &outputFileArg, const CppUtilities::Argument &validateArg);
void displayTagInfo(const CppUtilities::Argument &fieldsArg, const CppUtilities::Argument &showUnsupportedArg, const CppUtilities::Argument &filesArg,