Class LrExportSession

This class provides access to a list of photos to be exported and the renditions of those photos to be generated during an export operation.
  • Use the imported namespace as a constructor; access the functions through the created objects.
  • An object is also available from the exportContext.exportSession property.

Summary

LrExportSession( params )
Creates an export session object.
Reports the number of renditions that will be generated by this session.
Creates all of the renditions specified by this export session.
Starts rendering photos in a new asynchronous task.
Creates an iterator with which to walk the list of photos to be exported.
Records the unique identifier assigned to a published collection.
Records the URL assigned to a published collection.
Removes all renditions for a photo from the export session.
Creates an iterator with which to walk the list of renditions generated for this session's photos.
Creates an iterator with which to walk an export filter's renditions-to-satisfy list.
Reports the type of this object.
(LrCatalog) The catalog object for this export session.

Functions

LrExportSession( params )
Creates an export session object. The session acts on a specific set of photos and settings, as when a session is started in the Export dialog.

First supported in version 1.3 of the Lightroom SDK.

Parameters

1. params
(table) Arguments in named-argument syntax. All are required.
  • photosToExport (array of LrPhoto) A set of photos to be exported in this session.
  • exportSettings (table) A set of export settings for this session, as generated by the Export dialog.

Return value

An exportSession object.

See also

LrCatalog, LrPhoto
exportSession:countRenditions()
Reports the number of renditions that will be generated by this session.

First supported in version 1.3 of the Lightroom SDK.

Return value

(number) The number of renditions.
exportSession:doExportOnCurrentTask()
Creates all of the renditions specified by this export session. This function must be called from an asynchronous task. This task blocks until all renditions are created.

First supported in version 1.3 of the Lightroom SDK.

See also

LrTasks
exportSession:doExportOnNewTask()
Starts rendering photos in a new asynchronous task. It is safe to call this function whether in a task or not. This function returns immediately; it does not wait for rendering to complete.

First supported in version 1.3 of the Lightroom SDK.

See also

LrTasks
exportSession:photosToExport()
Creates an iterator with which to walk the list of photos to be exported. Use to wrap a loop that processes each photo.

First supported in version 1.3 of the Lightroom SDK.

For example:

 for photo in exportSession:photosToExport() do 
    -- (do something with photo)
end

See also

LrPhoto
exportSession:recordRemoteCollectionId( remoteId )
Records the unique identifier assigned to a published collection. Use only when publishing. This ID is passed back to the plug-in whenever the collection needs to be updated.

First supported in version 3.0 of the Lightroom SDK.

Parameters

1. remoteId
(string or number) The unique ID for the collection, assigned by the service
exportSession:recordRemoteCollectionUrl( remoteUrl )
Records the URL assigned to a published collection. Use only when publishing. This URL is used by Lightroom's "Go to Published Collection" command. Do not use for services that are not web-based.

First supported in version 3.0 of the Lightroom SDK.

Parameters

1. remoteUrl
(string or number) The URL of the collection, assigned by the service
exportSession:removePhoto( photo )
Removes all renditions for a photo from the export session. It is safe to call this function while using the photosToExport() iterator. Be aware, however, photosToExport() takes a snapshot of the photos to be exported at the beginning of the call and does not update that list in response to removePhoto. Thus if you remove a photo that has not been seen yet by the iterator during the iteration, the iterator still reports that photo.

Note that this function behaves differently from LrExportRendition:skipRender in that photos removed via this function do not appear in iterations that are started after this call occurs; photos that are skipped via LrExportRendition:skipRender do appear in that loop even though they are not rendered.

First supported in version 1.3 of the Lightroom SDK.

Parameters

1. photo
(LrPhoto) The photo to remove.

See also

LrPhoto
exportSession:renditions( params )
Creates an iterator with which to walk the list of renditions generated for this session's photos. Use in a FOR loop, within which operations on the LrExportRendition objects can take place.

First supported in version 1.3 of the Lightroom SDK.

For example:

 for i, rendition in exportSession:renditions() do
    -- (do something with rendition)
end

Parameters

1. params
(table, optional) Arguments in named argument syntax; all arguments are optional.
  • exportContext (LrExportContext): An export context.
  • progressScope (LrProgressScope): A progress scope.
  • renderProgressPortion (number): Percentage completion for progress scope when done, [0..1].
  • stopIfCanceled (Boolean): True to stop the iterator prematurely if progress scope is canceled. The flag is ignored if progressScope is not supplied.

See also

LrExportRendition, LrExportContext, LrProgressScope
exportSession:renditionsForFilter( params )
Creates an iterator with which to walk an export filter's renditions-to-satisfy list. The iterator generates a rendition from this export session (that is, before the application of this filter) and matches it with the corresponding rendition to be satisfied by the filter.

First supported in version 2.0 of the Lightroom SDK.

For example:

 for sourceRendition, renditionToSatisfy in exportSession:renditionsForFilter( params ) do
    -- (do something with rendition)
end

Parameters

1. params
(table, optional) Arguments in named argument syntax.
  • plugin (_PLUGIN object)
  • renditionsToSatisfy (array of LrExportRendition): The list of renditions that this filter must satisfy.
  • filterSettings (function, optional): If present, this function can alter the export settings of the rendition. It is called with two arguments: the individual rendition to be satisfied, and a copy of its export settings that can be modified in place. It can optionally return a string, which will be used as the new path to the file.

See also

LrExportRendition, LrProgressScope
exportSession:type()
Reports the type of this object.

First supported in version 4.1 of the Lightroom SDK.

Return value

(string) 'LrExportSession'.

Properties

exportSession.catalog : (Read-Only)
(LrCatalog) The catalog object for this export session.

First supported in version 1.3 of the Lightroom SDK.

See also: LrCatalog