metadata-extractor icon indicating copy to clipboard operation
metadata-extractor copied to clipboard

Add method returning a mapping from tag name to tag value for more generic access

Open sknull opened this issue 2 years ago • 1 comments

Hej,

for a new project we need a more generic access to directories without needing to know specific key names. The descriptors also make it necessary to actually know the key names. In our example we need dictionary like access to the IPTC metadata. To make this possible I added the method getTagMap() which returns just that as a readonly map of course to prevent external manipulation. I hope this pull request is concise enough to be considered merging.

Cheers, Stephan

sknull avatar Jan 06 '23 16:01 sknull

Thanks for the PR!

I wonder what this gives over just iterating the contents of the directory and building the map externally? I think that'd have better performance, as this loops over all possible tags, rather than only those which are present.

This method also excludes all unknown tag values, which I think might be surprising for some folks.

My thinking is that this method could be written by a consumer of the library, even without access to the protected getTagNameMap. Am I missing something?

drewnoakes avatar Jan 10 '23 10:01 drewnoakes