File Xmp.lua

Functions

Xmp:assureSettings (photo, xmpPath, ets) Assure the specified photos have settings in xmp, without changing settings significantly.
Xmp:getSourceFiles (photo, metaCache) Get photo path and xmp file (path), if applicable.
Xmp:getXmpFile (photo, metaCache) Get xmp file: depends on lrMeta, and metaCache recommended.
Xmp:isChanged (xmpFile1, xmpFile2, fudgeFactorInSeconds) Determine if xmp file has changed significantly, relative to another.
Xmp:new (t) Constructor for new instance.
Xmp:newClass (t) Constructor for extending class.
Xmp:transferMetadata (params) Transfer develop settings and/or metadata from one image file to another, via xmp.


Functions

Xmp:assureSettings (photo, xmpPath, ets)
Assure the specified photos have settings in xmp, without changing settings significantly. ###3 It seems this function is not being called anywhere - certainly xmp-crop could call it, but isn't (I'm guessing I forgot to retrofit or decided not to or something).

Parameters:

  • photo:
  • xmpPath:
  • ets:
Xmp:getSourceFiles (photo, metaCache)
Get photo path and xmp file (path), if applicable.

Parameters:

  • photo:
  • metaCache:
Xmp:getXmpFile (photo, metaCache)
Get xmp file: depends on lrMeta, and metaCache recommended.

Parameters:

  • photo:
  • metaCache:
Xmp:isChanged (xmpFile1, xmpFile2, fudgeFactorInSeconds)
Determine if xmp file has changed significantly, relative to another.

Parameters:

  • xmpFile1:
  • xmpFile2:
  • fudgeFactorInSeconds:

Usage:

    both files must exist. 

Return values:

  1. status ( boolean, always returned ) true => changed, false => unchanged, nil => see message returned for qualification.
  2. message ( string, if status = nil or false ) indicates reason.
Xmp:new (t)
Constructor for new instance.

Parameters:

  • t:

Return values:

  1. new image instance, or nil.
  2. error message if no new instance.
Xmp:newClass (t)
Constructor for extending class.

Parameters:

  • t:
Xmp:transferMetadata (params)
Transfer develop settings and/or metadata from one image file to another, via xmp.

Parameters:

  • params: (table, required) named parameters:
    xmpSrcFile (string, required) source xmp file (will be xmp sidecar or rgb file).
    xmpDestFile (string, required) destination xmp file (will be xmp sidecar or rgb file).
    xfrDev (boolean, default=true) iff true transfer develop settings.
    xfrMeta (boolean, default=true) iff true transfer (other) metadata.
    metadataCache (LrMetadata::Cache, optional).
    exifToolSession (ExifTool::Session, required) ets.

Usage:

  • *** Calling context MUST assure xmp source file is fresh before calling this function, otherwise data will be lost.
  • *** Likewise, dest xmp file must exist. It need not be so fresh, since it will be mostly redone, but probably a good idea to freshen it too before calling.
  • ###3 It could be that source and/or dest settings need to be pre-assured for dev transfer - not sure atm.
  • The reason this function does not assure-settings is because it's supposed to be callable even if one (or both) photos are not in the catalog - thus only file paths (not photo objects) are available.
  • Does some verbose logging, but offers no captions, so display in calling context, and log result upon return.
  • The code upon which this is based was developed for raw+jpeg plugin. It has since been adapted to (hopefully) cover all file types, and whether files are in catalog or not. But since fresh xmp must be pre-assured, one would need to invoke exiftool to "save metadata" if src or dest file is not photo in catalog. 

Valid XHTML 1.0!