File Previews.lua

Functions

Previews:assureFreshness (params) Assure preview freshness prior to embarking on operation that depends on freshness.
Previews:getDatabaseInfo () Get preview database info - presently only supports active catalog.
Previews:getImage (photo, photoPath, previewFile, prefLevel, minLevel, freshness, icc, profile, meta, orient, mogParam, fmtMeta, ets, assureDir, dontOverwrite, tryNewLr5WayFirst) Get a preview image corresponding to specified photo, at the specified level, if possible.
Previews:getSmartPreview (params) Get smart preview *file* associated with specified photo etc.
Previews:isFinalPreviewFresh (photo, tmo) Determine if final (1:1) preview is fresh.
Previews:isPreviewFresh (photo, tmo) Determines if preview is fresh (accepts either standard or final quality).
Previews:isStandardPreviewFresh (photo, tmo) Determine if standard preview is fresh.
Previews:new (t) Constructor for new instance.
Previews:newClass (t) Constructor for extending class.


Functions

Previews:assureFreshness (params)
Assure preview freshness prior to embarking on operation that depends on freshness.

Parameters:

  • params:

Usage:

    could be robustened to allow param for whether already in lib module / grid mode, and whether target module should be assured upon prior to returning. 
Previews:getDatabaseInfo ()
Get preview database info - presently only supports active catalog.
Previews:getImage (photo, photoPath, previewFile, prefLevel, minLevel, freshness, icc, profile, meta, orient, mogParam, fmtMeta, ets, assureDir, dontOverwrite, tryNewLr5WayFirst)
Get a preview image corresponding to specified photo, at the specified level, if possible.

Parameters:

  • photo: (LrPhoto or table of param, required) specified photo, or table of named parameters (recommended) - same as below including photo=lr-photo:
  • photoPath: (string, optional) photo-path if available, otherwise will be pulled from raw-metadata.
  • previewFile: (string, default=unique-temp-path) target path to store jpeg - if non-nil value passed and file is pre-existing, it will be overwritten.
  • prefLevel: (number, required) appx sizes + intended use:
    1 - 80x60 small thumb
    2 - 160x120 medium thumb
    3 - 320x240 large thumb
    4 - 640x480 small image
    5 - 1280x960 medium image
    6 - 2560x1920 large image
    7 - 1:1 full-res
  • minLevel: (number, default=1) minimum acceptable level.
  • freshness: (number, default=1) 0 => whatever is handy (no longer supported); 1 => use dates to determine freshness (*** was recommended - no longer supported ***); 2 => freshen regardless of dates; 3 => must be hot off the press.
  • icc: (string, default='I') determines if icc profile management is desired, 'A' means assign, 'C' means convert, & 'I' or nil means ignore.
  • profile: (string, default=nil) target profile, if icc is to be assigned or converted. 'sRGB', or 'AdobeRGB'.
  • meta: (boolean, default=false) determines if metadata transfer is desired.
  • orient: (boolean, default=false) determines if orientation should be corrected via image mogrification.
  • mogParam: (string, optional) mogrify-compatible parameter string if desired, e.g. for resizing...
  • fmtMeta: (table, optional) lightroom formatted metadata obtained en batch.
  • ets:
  • assureDir:
  • dontOverwrite:
  • tryNewLr5WayFirst:

Usage:

  • file, errm, level = cat:getPreview{ photo=catalog:getTargetPhoto(), level=5 }
  • file, errm, level = cat:getPreview( catalog:getTargetPhoto(), nil, nil, 5 ) 

Return values:

  1. image (Image, or nil) preview as image object representing requested preview.
  2. errm (string, or nil) error message if unable to obtain requested preview (includes path(s)).
  3. level (number, or nil) actual level read, which may be different than requested level if min-level passed in.
Previews:getSmartPreview (params)
Get smart preview *file* associated with specified photo etc.

Parameters:

  • params: (table, required) with members:
    photo (LrPhoto, required) photo.
    photoPath (string, optional) photo path.
    cache (lr-metadata-cache, optional) with "smart-preview-info" in it, else useless here.

Return values:

  1. path (string) if obtainable.
  2. nil, errm if not.
Previews:isFinalPreviewFresh (photo, tmo)
Determine if final (1:1) preview is fresh.

Parameters:

  • photo:
  • tmo:
Previews:isPreviewFresh (photo, tmo)
Determines if preview is fresh (accepts either standard or final quality). reminder: previews are not freshened in develop module, so switch to library module before bothering with this function. note: this function executes "pseudo-synchronously", such that if command-line/sqlite is hung (it unfortunately does happen sometimes), it will be abandoned (eventually hung command tasks will populate the process list...) - not sure what else to do though. ###3

Parameters:

  • photo:
  • tmo:
Previews:isStandardPreviewFresh (photo, tmo)
Determine if standard preview is fresh.

Parameters:

  • photo:
  • tmo:
Previews:new (t)
Constructor for new instance.

Parameters:

  • t:
Previews:newClass (t)
Constructor for extending class.

Parameters:

  • t:

Valid XHTML 1.0!