Add metadata query to Lua API#20968
Open
wpferguson wants to merge 1 commit intodarktable-org:masterfrom
Open
Conversation
internally from the Lua.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#20872 added the ability for users to add additional metadata fields that are populated on image import.
The Lua API adds those fields to the
dt_lua_image_tdatatype as accessible members.If you try and access a
dt_lua_image_tmember that doesn't exist, Lua throws an error that stops script execution. The error can't be caught with apcall().The fix is adding some metadata functionality to the Lua API. This PR adds a
darktable.metadata.exists(<exif tag name>)function to the API that returns true or false based on whether a user has registered the metadata in metadata editor. Scripts can use this information to decide whether to spawn an external executable (exiv2 or exiftool) to get metadata or use the internal metadata.Currently the metadata section only includes
exists(). Future functionality could be added to add and remove additional metadata tags without the user having to intervene. With the short time until feature freezeexists()is a needed feature and the others can wait.To test...
test_metadata_api.zip