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

fully configurable metadata module #18036

Open
wants to merge 37 commits into
base: master
Choose a base branch
from

Conversation

zisoft
Copy link
Collaborator

@zisoft zisoft commented Dec 21, 2024

This PR implements a fully configurable metadata module. It allows to maintain every tag which is supported by exiv2.

fixes #13607
fixes #17664
fixes #18147


The metadata tags are maintained in a new database table data.meta_data, the previous darktable tags are created at database migration.

So the metadata module looks exactly like before:

metadata_1

The metadata preferences dialog now shows the tagname and has buttons to add new tags and to delete tags:

metadata_2

Clicking the + button to add new tags opens the tag dialog which is already known from the export module:

metadata_3

Search for the desired tags and add them by either double click or the add button. In this example the user wants to add the Xmp.iptc.AltTextAccessibility and Xmp.iptc.Location tags. Click done and the tags are added to the metadata preferences dialog.

Edit the display name:

metadata_4

and drag the tag to change the order to your liking:

metadata_5

Click save and the metadata module is immediately updated:

metadata_6

As well as the metadata section of the import module:

import

The new tags can immediately be used in the collections module:

collection

...and the image information module (this module has its own preferences for show/hide and display order):

image_information

Finally, the new tags can now be used as variables:

variables

@wpferguson
Copy link
Member

I'll test the lua part.

@dterrahe
Copy link
Member

Just picking out one random thing (not pretending at all that this amounts to anything like the in depth review this big PR deserves), but why don't you create one global GtkListStore and reuse that as the model for the completion of each entry calling dt_gtkentry_setup_variables_completion. Then you'd only need to update that liststore and there's no need to send a signal for each individual module to update its widgets.

@wpferguson
Copy link
Member

Started testing. Created a fresh environment and pulled the PR. Imported a directory of play raws. Tested a lua script to add a field to the image information module. It added the field, but it didn't show up in the preferences and I couldn't control the visibility, which I can with current master. Stopped darktable, then restarted it. The collection of play raws would not display. Went to the collections module and double clicked on the play raw collection and it still wouldn't display.

I'll continue testing...

@wpferguson
Copy link
Member

Along with not displaying the field in the preferences, it seems to cause a crash when exiting, which is what stopped the collection from displaying since darktable did not shut down cleanly.

The error:

free(): invalid pointer
/home/bill/bin/dttest_18036_metadata: line 1: 2597747 Aborted                 (core dumped) /opt/dttest_18036_metadata/bin/darktable -d lua -d pwstorage --cachedir $HOME/.cache/dttest_18036_metadata --configdir $HOME/.config/dttest_18036_metadata $@

Here's the script:
metadata_manager.lua.txt

drop it in your contrib lua scripts directory and remove the .txt extension.

start darktable, then start the script. It adds a module to lighttable below image information.

In the metadata display name field enter color space

In the tag field enter Exif.Photo.ColorSpace

Click create and color space should appear at the top of the module. Click the check box to select it if it isn't. Click the activate button to add it to the image information display. Canon images support it and maybe sony.

The script requires the exiv2 program be installed and in your path.

Hover over images and it should update.

Just tested again, and I deactivated the field (removed it from the image information display) and didn't get a crash.


On another note. How can I notify Lua of the changed collection fields, since I can control collections from Lua.

@zisoft
Copy link
Collaborator Author

zisoft commented Dec 22, 2024

@wpferguson thanks for testing so far, I will look into that (I know near to nothing about Lua).

The crash on exit is another story: #18023

@zisoft
Copy link
Collaborator Author

zisoft commented Dec 22, 2024

why don't you create one global GtkListStore and reuse that as the model for the completion of each entry

@dterrahe: I had to read that twice but now I got your point. The variables completion was indeed somewhat complicated and it was the last part I have implemented in this PR. Your suggestion sounds good, I will work on that.

@TurboGit TurboGit added this to the 5.2 milestone Dec 22, 2024
@TurboGit TurboGit added scope: DAM managing files, collections, archiving, metadata, etc. feature: enhancement current features to improve documentation-pending a documentation work is required release notes: pending labels Dec 22, 2024
@zisoft
Copy link
Collaborator Author

zisoft commented Dec 22, 2024

@dterrahe: I followed your suggestion, works great! So I could completely remove the signal handlers for the variables completion.

@zisoft
Copy link
Collaborator Author

zisoft commented Dec 22, 2024

@wpferguson: I think I have fixed the Lua issues in the image information module, can you please test again?

On another note. How can I notify Lua of the changed collection fields, since I can control collections from Lua.

In the collection module I have written the code to register the collections. Can you give me some advice/script on how to test this?
What if the user removes a metadata tag? Is there some "unregister" needed in Lua?

@wpferguson
Copy link
Member

wpferguson commented Jan 7, 2025

Using a script if I have a metadata active in the image information display, then stop and start darktable, the metadata doesn't appear in the image information display, nor in the preferences. I have to "remove it" then reactivate it to get it to appear.

EDIT: also getting

(darktable:2446311): GLib-CRITICAL **: 14:18:33.896: g_hash_table_foreach: assertion 'hash_table != NULL' failed

(darktable:2446311): GLib-CRITICAL **: 14:18:33.896: g_hash_table_destroy: assertion 'hash_table != NULL' failed

(darktable:2446311): GLib-CRITICAL **: 14:18:33.896: g_hash_table_destroy: assertion 'hash_table != NULL' failed

in the terminal

EDIT 2: After further testing, I can't reproduce the doesn't display after reload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation-pending a documentation work is required feature: enhancement current features to improve release notes: pending scope: DAM managing files, collections, archiving, metadata, etc.
Projects
None yet
4 participants