I'm outside my area of experience. Although the following would certainly be critical:
I can't see any function for initial creation/naming either though. Hmmmmm..... another hole?
I suppose you could create an asynchronous task to poll the server for existing names, and if the results are not in yet, return false, "hang on..." from validatePublishedCollectionName, else compare entered value to existing names...
Sorry if I've not been much help,
Hey Rob! Thanks for the reply. I'm not sure about this, but here's how I solved it: From within updateCollectionSettings when I determine there is a name collision I use the following code to remove the collection:
local catalog = import "LrApplication".activeCatalog()
catalog:withWriteAccessDo( "Remove invalid collection", function()
It works. Not sure it's the best solution, but I'm running with it for now.
It seems my previously proposed solution would be better - so the user sees "bad name", instead of having their collection disappear.
But I suppose as long as you prompt the user so it doesn't just seem flaky...
Like Rob said, it looks like you're expected to do the server-side verification in
renamePublishedCollection( publishSettings, info )
reparentPublishedCollection( publishSettings, info )
The doc states, "If your plug-in is unable to update the remote service for any reason, you should throw a Lua error from this function; this causes Lightroom to revert the change."
I tried to hook into renamePublishedCollection and reparentPublishedCollection but it appears that those methods don't fire when the Published Collection is created. I indeed got them to fire when I'm renaming or reparenting aPublished Collection, but I can't find any other way to prevent the creation of a Published Collection other than in updateCollectionSettings.
1 person found this helpful
function PS:validatePublishedCollectionName( name )
if nameInfoLoaded then
if duplicateName( name ) then
return false, "duplicate name"
return false, "Contacting server to check collection name..."
Then, in "start dialog" method, create the task that loads name info from server.
in "end dialog" method, kill the task, if it doesn't die by itself...
Although a little rough for you, 'twould be smooth as silk for your users.
Rob, yes! That's a great way to go. Although, I'll still have to implement the other code (collection appears and then dissapears) because, while I can obtain a list of collections from the service for the user and ensure the the uniqueness among the user's collection, I still must ensure the unqiueness of the name across ALL service users - and then only way to do that is to contact the service with the proposed name.
1 person found this helpful
The only trick is keeping multiple instances of the name checking task from running if user is yanking the plugin manager around and reloading the plugin...
Lightroom does NOT stop tasks from running automatically even if you reload the plugin.
So, make sure you have a shutdown module: LrShutdownPlugin = ... defined in Info.lua - have it set a global shutdown flag that you check in your task.
I mean, this only makes sense if the task is going to have loops with sleeps and such.... - if it's a one shot and it's done, then there is no opportunity to check the shutdown flag.