Skip to main content
Known Participant
September 23, 2018
Answered

Read Metadata of Photo During Export

  • September 23, 2018
  • 1 reply
  • 818 views

I am working on a plugin that will help me optimize a publishing workflow. I think that the plugin will be most effective if it is applied during the process of exporting the image. The problem I am having after reviewing and playing with the two Export samples in the SDK I am not understanding how I can get a reference the current Photo while in postProcessRenderedPhotos. I see sourceRendition but is that a LRPhoto? The documentation is not clear on that an I am struggling to find any non-compiled samples in the wild.

I see that shouldRenderPhoto has a reference to the Photo, but I don't need to control what get's rendered. Does it matter? Should I just collect my metadata here and always pass shouldRender = true?

Essentially, as photos are exported I need to write a text sidecar file to go with each one that conforms to a DAM spec that is using data already stored with the image in LR metadata.

I know I can do this by looping through the "selected photos" in the grid, but that would cause my users to have to perform two actions rather than have it all together in the Export panel.

This topic has been closed for replies.
Correct answer johnrellis

You need a colon to invoke the method getFormattedMetadata():

renditionToSatisfy.photo:getFormattedMetadata( "fileName" )

1 reply

johnrellis
Legend
September 24, 2018

Looking at page 49 of the Lightroom SDK Guide, the function postProcessRenderedPhotos() iterates through the iterator filterContext:renditions(), each iteration providing a sourceRendition and renditionToSatisfy.  The sourceRendition is of class LrExportRendition, and the documentation for that class indicates that exportRendition.photo is of class LrPhoto, "The photo to be rendered in this operation".

Known Participant
September 24, 2018

I have tried renditionToSatisfy.photo.getFormattedMetadata( "fileName" ) but it crashes out.

I know I am missing something.

I'd like the file name of the export file without the full path.

johnrellis
johnrellisCorrect answer
Legend
September 24, 2018

You need a colon to invoke the method getFormattedMetadata():

renditionToSatisfy.photo:getFormattedMetadata( "fileName" )