Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sknull
Copy link

@sknull sknull commented Jan 6, 2023

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

@drewnoakes
Copy link
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants