Instead of a companion .xml file, you could store your data in industry-standard XMP in a custom schema. The XMP for JPEG, TIFFs, DNGs, PNGs, and videos is stored inside the file, and the XMP for raw files is stored in a sidecar .xmp file. Storing the data in XMP ensures that it will stay with the file if you rename, move, or import photos inside LR.
Your plugin could invoke the free Exiftool to read and write the metadata. Before writing the metadata to the file, your plugin could invoke the undocumented photo:saveMetadata() to do the equivalent of Metadata > Save Metadata To File.
I think it will take a couple hours to figure out how to configure Exiftool to read and write custom XMP schemas, but it looks pretty well documented.
Your're right, we have tried to implement them with XMP but we have some problem. There is some possibilities to write down data inside Lightroom database, associate them with a photo file and then read them from the database?
There is some possibilities to write down data inside Lightroom database, associate them with a photo file and then read them from the database?
Yes, plugins can create custom metadata fields for photos in the database. See Chapter 4: Working With Metadata in the LR SDK Guide.
Custom metadata can be very useful, but it doesn't meet all your requirements. If you add custom metadata to a photo and then import that photo into a new catalog, the custom metadata won't transfer (because it is stored in the catalog, not the photo's file).
I want to continue with the road of Lightroom's custom metadata. If user want to keep metadata, they have to backup the LR's catalog.
In chapter 4, I've not understand why I can't fill metadata's values with my values. How to set properly a custom metadata's field proprerly from the plugin?
If you've defined a custom metadata field as described in chapter 4, then your plugin can use photo:getPropertyForPlugin() and photo:setPropertyForPlugin().
Thank you so much! no I try.
for TOMAREOMO in LrFileUtils.files(filePath) do if LrPathUtils.extension( TOMAREOMO ):lower() == "xml" then LrDialogs.message(filePath .. " " .. TOMAREOMO .. " " .. masterDir) local result, err = LrFileUtils.copy(TOMAREOMO, masterDir) LrDialogs.message(tostring(result)) end end
error is null.
result is false, It doesn't copy my file.
directory where I want to copy:
if I open file and directory with terminal, I can do it. Why It fails?
I'll answer to myself as a note for the others: when you use LrFileUtils.copy(filePath, destinationDir), on the destinationDir you have to concat the name of the file, not only the destination folder.
For example, if you have to copy on User/myname/pics the file test.jpg, destinationDir is User/myname/pics/test.jpg