5 Replies Latest reply on Dec 20, 2011 5:17 AM by paco83

    Create a Stack programatically


      I'd like to be able to create a stack programatically, but I'm having some problems with that.  I have found these 2 possibilities, but both have problems I have not been able to work around:


      1) Use catalog:addPhoto to create the stack

            - Problem: The photos i want to use in the stack are both already loaded in the catalog.  Running addPhoto on a photo that is already in the catalog throws an error, and I can't find anyway to remove the photo from the catalog without deleting it.


      2) Modify all stack related RawMetadata

           - Problem: stack related metadata keys are not valid in the SetRawMetadata function


      If anyone has any other ideas, or solutions to either of the problems about it would be much appreciated.




        • 1. Re: Create a Stack programatically
          johnrellis Most Valuable Participant

          I don't think it is possible for a plugin to stack photos that are already in the catalog.  As you observed, addPhoto() only works for photos not in the catalog, and the SDK provides no way for removing photos from the catalog.

          1 person found this helpful
          • 2. Re: Create a Stack programatically
            paco83 Level 1

            Thanks, that's what I was afraid of..... Time to start playing with PERL, SQLITE, and the lrcat file to manually edit the database.  Will just have to try it on a test catalog before trying this!

            • 3. Re: Create a Stack programatically
              DawMatt Level 3

              You are braver than I!


              Be aware that by modifying the database directly you can do a lot of damage and Lightroom support might not be able (or even willing) to help you recover from it. Backups are your friend if you go down this path.



              • 4. Re: Create a Stack programatically
                areohbee Level 6

                Easy to do with an SQLite client, but NOT while Lightroom has the catalog open. Which means you can't do it from a plugin, unless your user's are willing to restart Lightroom.

                • 5. Re: Create a Stack programatically
                  paco83 Level 1


                  I'm the type of guy that voids the warrenty on everything i buy .  I'm also completely an amature so even if I lost my catalog, it would just be some frustration and swearing on my end.  That being said, I do go backup crazy with daily backups through Acronis True Image, and weekly backups through lightroom.  Oh and did I mention these backups are copied across 3 different computers?



                  I did write another plugin that used sql to query the catalog so I did know that you can't use it while Lightroom has the catalog open.  In my previous plugin i got around the issue by having it use the latest backup catalog to do the query on (it's only SELECT statements). In this case I think I'll turn it into a launcher so it runs before every time you start lightroom.  I'm really working on this just for me, if I end up with something that at least half works and others are interested I would certainly share with the community