Project

General

Profile

Bug #12262

colorlabel not updated in xmp-sidecar when changed via lua-script

Added by osen boz 4 months ago. Updated 4 months ago.

Status:
New
Priority:
Low
Category:
Lua
Target version:
-
Start date:
07/13/2018
Due date:
% Done:

0%

Affected Version:
2.4.4
System:
Windows
bitness:
64-bit
hardware architecture:
other

Description

basically i've written a simple lua-script that updates colorlabels of each
image-group-member so that i can synchronize colorlabels between
raw- and jpeg files and at a first glance it seems to work flawlessly.

however, while trying to filter my newly colorlabelled images, i
noticed that the colorlabels are only viewed correctly in the gui,
and not actually changed in the corresponding xmp-sidecar files!
(of course the option "write sidecar-files for each image" is enabled,
and the xmp-files are correcty updated in case i just click on the
colorlabel-buttons in the gui)

since also filtering etc. does not work with respect to the colorlabels
that are displayed in the gui, i guess also the database is not correctly
affected by the script!?

...the script looks something like this:
(this is just a snippet that shows how the colorlabel is changed...
it appears in a function that is called via a shortcut to apply the label)

local dt = require "darktable"
local images = dt.gui.action_images
for _, i in ipairs(images) do
local members = i:get_group_members()
for _, m in ipairs(members) do
m.blue = true
end
end

greets, raphael

History

#1 Updated by osen boz 4 months ago

... since this bothered me quite a bit i decided to spend some more time on it...
and i actually found a workaround!

adding the following lines to the previous code results
in a correct updating of the colorlabels in the xmp-files!

(so i guess what's needed might be something like a "update_labels_tags()" function
that can be called after certain changes to the colorlabels have been performed
to actually incorporate them into the sidecar-files)

local dummytag = dt.tags.create("this is a unused dummy tag 918273645")
m:attach_tag(dummytag) -- attach a dummy-tag to update the xmp-file
dt.tags.delete(dummytag) -- delete the dummy-tag again

Also available in: Atom PDF