I’ve just written a quick lua shell plugin for Lightroom, mostly to help me write other plugins, but I think it will also be an easy way to manipulate photo metadata. Writing it was pretty easy, though my one frustration was that the Lightroom plugin API does not appear to provide a way to make scrollable dialogs, so the output view will fill up and have to be cleared. The famous Lightroom plugin writer Jeffrey Friedl appears to have solved this by writing his own scrollbar widgets, so I may have to do that eventually.
To get the code/plugin (I’ve left the Lua uncompiled), head to https://github.com/afiler/luashell.lrdevplugin.
Pre-loaded extras provided in the shell environment include:
- catalog => LrApplication.activeCatalog()
- target => LrApplication.activeCatalog():getTargetPhoto()
- targets => LrApplication.activeCatalog():getTargetPhotos()
Of course, you can still call import() just as you would inside a plugin.
Note that commands that would normally need to be called asynchronously (within an LrTask) are silently wrapped, so that:
x = target:getRawMetadata(‘fileSize’)
LrTasks.startAsyncTask(function() x = target:getRawMetadata(‘fileSize’)) end)
Note that in the result window, normal return values are prefixed by “->”, while asynchronous return values are prefixed by “=>”.