Skip to main content
Known Participant
May 11, 2013
질문

How to find keyword object based on name

  • May 11, 2013
  • 1 답변
  • 1078 조회

I have a CSV file with file name and keywords.

XXX_201300511_08765.CR2,Amsterdam

These keywords already exist in Lightroom.

Sample: Europe->Netherlands->Amsterdam

I understand that with photo:addKeyword ( keyword object) I can add keywords to photos.

How can I find the keyword object in Lightroom.

For the example, how can I find the keyword object of Amsterdam.

이 주제는 답변이 닫혔습니다.

1 답변

johnrellis
Legend
May 11, 2013

If you want a table mapping the leaf names (e.g. "Amsterdam") to the corresponding LrKeyword objects, you'll have to write a recursive function that traverses the keyword hierarchy, building the table entries as you go.  You can get to the root of the hierarchy using catalog:getKeywords(), and you can get the children of any one LrKeyword object using keyword:getChildren().

dhmc05작성자
Known Participant
May 12, 2013

Thank you John!, I was afraid that that would be the only solution.

Imho the API of keywords should be extended with a function / method to retrieve all keywords objects based on the name description. I will make the suggestion apart.

It is possible to find all photo object when supplying the name, like catalog:findPhotos and catalog:findPhotoByPath. Similar functions for keywords would be great.

Are there code recipes for such a table implementations?

johnrellis
Legend
May 12, 2013

Are there code recipes for such a table implementations?

I don't know of any published recipes or code examples for this.  The LR SDK community is pretty small, unfortunately.