Lightroom SDK: Plugin API to unlock database temporarily.

  • 4
  • Idea
  • Updated 7 years ago
This is one of my highest hopes for the Lightroom SDK

As much as I love having a nice API for reading the Lightroom catalog, sometimes a lightening-fast SQL query could return much more info much faster. My present workaround is to issue a command to kill Lightroom, then read the now unlocked Lightroom database, then restart Lightroom. This is very disconcerting to the user, and a bit tricky to program plugins that can continue where they left off once Lightroom restarts.

I would also love the ability to write the lrcat file too whilst unlocked, not just read it. But I figure I'm probably already pushing my luck right now, so I'd settle for read-only (especially if the catalog-write-via-api functions were augmented).

PS - If this were done in such a way that a plugin's partner "sidekick" app could have a whack at the database while its unlocked, this would make it possible to write more responsive distributed plugin / sidekick apps.

Summary:
------------
If only one feature were to be added to the Lightroom SDK, this one would have my vote, no question, by far, because non-modal plugins could be written as sidekick apps that could keep themselves up-to-date by periodic access to the Lightroom database.

PS - If anyone is interested in this topic. I've got a running demo now of such a sidekick plugin-app - details available upon request.

To Adobe: If Lightroom SDK becomes a separate sub-product on this site - please move this FR/Idea there.

Note: I'd settle for an exhaustive API for catalog I/O as well, although presently some things are nearly prohibitively slow - sometimes one has to compromise... So, maybe instead of unlocking the database completely, an API like "catalog:submitSqlQuery( sql )" - that way Lightroom maintains control of the database, but plugins still have a way to retrieve any information.

If this is "never going to happen", then the most important info I'd like to have access to is:
- Preview Database-IDs for selected photos. As it stands, without restarting Lightroom, sidekick apps can only display previews for photos that were in the database before Lightroom started. With this changed, Sidekick apps could display previews for newly added photos too.

Conclusion:
--------------
I'd like SQL access to the Lr database, but I could go a long way with just the addition of one raw metadata item to the photo object: 'previewId'.

Rob
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 382 Reply Likes
  • thinking outside the box

Posted 7 years ago

  • 4
Photo of Photographe

Photographe

  • 243 Posts
  • 31 Reply Likes
Have you looked at IDimager? It seems to have pretty involved database structure (I believe with SQL everything, but that's Greek to me) and a well-respected script writing feature. Might be up your alley.
Photo of Jim Keir

Jim Keir

  • 20 Posts
  • 2 Reply Likes
Hi,

I'll second this one. Being able to execute SQL commands against the database, even read-only, would be enormously useful to plugin developers.

Rob, I've noticed that it's open for a few seconds after Lightroom starts up. I wonder if it would be possible to open a connection as part of a plugin's initialisation before the DB locks and then maintain it in a daemon process?

Cheers,
Jim
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 382 Reply Likes
Hey Jim,

Now that you mention it, I don't think I ever tried to maintain a connection after startup (or maybe I did but just dont remember). That seems pretty stupid of me, but for an arguably smart person I can still be pretty stupid sometimes (and/or forgetful). - I'll check, and report back (it may be a while), if you don't beat me to it. Deal?

-R
Photo of Jim Keir

Jim Keir

  • 20 Posts
  • 2 Reply Likes
Deal - might be a while for me too :) Hope it helps. I have definitely made a connection and run a query successfully as part of plugin activation, the question is whether that connection stays good once it's been opened.

Cheers,
Jim
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 382 Reply Likes
Jim,

My curiosity got the best of me so I tried it - database locked error.

Unless I screwed up my test somehow, conclusion is "no can do...".

Rob