3 Replies Latest reply on Mar 13, 2012 1:05 PM by clvrmnky

    Published service name in shouldDeletePhotosFromServiceOnDeleteFromCatalog() callback?

    Don McKee

      In my published service provider's shouldDeletePhotosFromServiceOnDeleteFromCatalog()callback, I'd like to build a custom confirmation dialog that includes the name of the published service that the photo belongs to, similar to what Lightroom's built-in dialog does.  However, I can't seem to find the name of the "active" published service (e.g. there's no relevant property set in the publishSettings table passed in as a parameter).  I'm running LR 3.6.

       

      Any suggestions how to find the published service name?

       

      -Don

        • 1. Re: Published service name in shouldDeletePhotosFromServiceOnDeleteFromCatalog() callback?
          clvrmnky Level 4

          I do something like this. It may be overkill for your purposes, but at least you can inspect the various tables and determine the pieces you need.

           

               -- Get all the publish service names for this plugin in this catalogue.
               local pubServices = LrApp.activeCatalog():getPublishServices(_PLUGIN.id)
          
               -- From this list of services, get a ref to the current one (which we know from the
               -- publish settings).
               local thisServiceName = publishSettings.LR_publish_connectionName
               --logger:trace("This service name: ", thisServiceName)
          
               local thisService = nil
               for _, service in pairs(pubServices) do
                    --logger:tracef("Found service %s (%s)", service:getName(), service.localIdentifier)
                    -- NOTE: we assume this is not terribly brittle.
                    if service:getName() == thisServiceName then
                         -- We found our current service instance. Save it and bail out of the loop.
                         thisService = service
                         break
                    end
               end
          
          1 person found this helpful
          • 2. Re: Published service name in shouldDeletePhotosFromServiceOnDeleteFromCatalog() callback?
            Don McKee Level 1

            Thanks for posting this!  Unfortunately, in my case anyway, the publishSettings table passed into the callback does not contain the  LR_publish_connectionName property (this is really all I'm looking for in the first place, I think). 

             

            -Don

            • 3. Re: Published service name in shouldDeletePhotosFromServiceOnDeleteFromCatalog() callback?
              clvrmnky Level 4

              Huh. I think that is a bug in the SDK, then.

               

              Try dumping the contents of the property table and see what is there.