Can I stack existing photos in the with the LR SDK?
Copy link to clipboard
Copied
I'm 100% new on this, so very sorry if it's a stupid question.
I want to write a simple plugin that that auto stack photos based on filename and folder. I basically want to auto stack the apple "live" photos, which is a jpeg and a mov, into 1 stack each. I've already built a proof of concept command line php script that does it and it works: it opens the LR database, queries all photos, group by folder+filename, and stacks the files with same folder+filename which are jpeg and mov.
I'm checking the SDK documentation but I can't find a way to stack photos other than adding them to the catalog. I don't want to remove them and re-add them if possible, I'm not sure if it could be problematic in other aspects.
Edit: actually, is it possible to query and modify the database directly through the SDK? That would clearly solve it since I already have it working, I would only have to translate it to Lua
BTW, I was thinking on this plugin as a menu item button to activate after each import. Is it possible to write plugins what execute on or after import?
Thanks in advance!
Copy link to clipboard
Copied
I'm checking the SDK documentation but I can't find a way to stack photos other than adding them to the catalog. I don't want to remove them and re-add them if possible, I'm not sure if it could be problematic in other aspects.
Unfortunately, you only stack photos when you do catalog:addPhoto(). There is no way in the SDK to remove photos from the catalog.
is it possible to query and modify the database directly through the SDK?
No. And LR locks the database, so it isn't possible for a running plugin to even read the database while LR is running. A few plugins jump through hoops to cause LR to exit, then run a shell script to access the database, then restart LR and resume the plugin.
Direct access to the database is completely unsupported by Adobe, of course, and they feel free to change the schema at any time.
Is it possible to write plugins what execute on or after import?
The SDK doesn't provide any mechanism for that.

