• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

photo.localIdentifier - what is it useful for?

Community Beginner ,
Jan 30, 2023 Jan 30, 2023

Copy link to clipboard

Copied

Hey,

 

for a plugin I would like to remember some photos that were used for an operation.  I thought that saving the photo.localIdentifier would be the best way to get me access to the LrPhoto again at a later point, however, there doesn't seem to be any way to do a lookup based on localIdentifier. The only option I see is the UUID, which is available via photo:getRawMetadata , which requires being inside an LrTask.

 

Two questions:

1) Is UUID the recommended way to remember a photo reference?

2) If yes, what's the point of photo.localIdentifier ? Only for debugging?

 

Martin

TOPICS
SDK

Views

114

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jan 30, 2023 Jan 30, 2023

"1) Is UUID the recommended way to remember a photo reference?"

 

If you want a reference to a photo that can be easily translated back to the LrPhoto, use the UUID and catalog:findPhotoByUuid().

 

You could use .localIdentifier, but to translate it back to an LrPhoto, you'd need to use catalog:getAllPhotos() to build a table mapping localIdentifier back to LrPhoto (which goes fairly fast, on the order of tens of thousands of photos per second, but slow enough that you might want to cache the mappin

...

Votes

Translate

Translate
LEGEND ,
Jan 30, 2023 Jan 30, 2023

Copy link to clipboard

Copied

"1) Is UUID the recommended way to remember a photo reference?"

 

If you want a reference to a photo that can be easily translated back to the LrPhoto, use the UUID and catalog:findPhotoByUuid().

 

You could use .localIdentifier, but to translate it back to an LrPhoto, you'd need to use catalog:getAllPhotos() to build a table mapping localIdentifier back to LrPhoto (which goes fairly fast, on the order of tens of thousands of photos per second, but slow enough that you might want to cache the mapping table in a global variable).

 

If you're writing a large number of references in a text file, .localIdentifier would cut down on the number of bytes written.

 

"2) If yes, what's the point of photo.localIdentifier ? Only for debugging?"

 

It's lost in prehistory. In general the SDK is an unfinished work-in-progress, with very little effort devoted to it since LR 3.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 30, 2023 Jan 30, 2023

Copy link to clipboard

Copied

LATEST

Thank you for the quick response and insights!

 

Building my own in-memory table of all photos seems like a lot of work and may hit memory limits. I suppose if I expect to look up a large fraction of the catalog, it might be faster than repeated findPhotoByUuid, but fortunately that's unlikely in my use case (and in the end I need to export the found photos... that will dominate the time spent anyways.)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines