简体   繁体   English

在 ExifTool output 中包含未指定标签的重复项

[英]Including duplicates in ExifTool output with Unspecified Tag

I'm trying to replicate the following command in Java, to capture the file names of some files in a zip.我正在尝试在 Java 中复制以下命令,以捕获 zip 中某些文件的文件名。

ExifTool.exe -a -ZipFileName C:\Users\Name\Downloads\file.zip

This gives the following output这给出了以下 output

Zip File Name                   : Scheme02_V1.tiff
Zip File Name                   : SupplementaryMaterialFigures_V1.docx
Zip File Name                   : SupplementaryMaterialTables_V1.docx

To do this using the mjeanroy java library, I've created a new UnspecifiedTag, to retrieve the zip file name.为此,我使用 mjeanroy java 库创建了一个新的 UnspecifiedTag,以检索 zip 文件名。

UnspecifiedTag zipFileNameTag = new UnspecifiedTag(ZIP_FILE_NAME);

in addition to a new execution strategy which includes the "-a" tag for duplicates.除了包含重复的“-a”标签的新执行策略之外。

However, this only seems to capture 1 document from the zip file.但是,这似乎只从 zip 文件中捕获了 1 个文档。

Map<Tag, String> zipFileNameMap =
                    tool.getImageMeta(tempFile, tagList);
zipFileNameMap.forEach((k, v) -> System.out.println((k + ":" + v)));

UnspecifiedTag{name: "ZipFileName"}:SupplementaryMaterialTables_V1.docx

In the documentation it mentions that when parsing, it returns a String[], however if I try and make the map Map<Tag, String[]> it fails.文档中它提到在解析时,它返回一个 String[],但是如果我尝试制作 map Map<Tag, String[]>它会失败。

What's happening is that duplicates are being overridden in the Map.发生的事情是 Map 中的重复项被覆盖。 In order to resolve this I've created some helper classes of several methods, making Map<String, Tag> and it's now adding all files to the map.为了解决这个问题,我创建了一些方法的帮助类,制作Map<String, Tag>并且现在将所有文件添加到 map。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM