INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Lightroom Hierarchical Subject - How can I create a tag in JRiver  (Read 6550 times)

GlennAlt

  • Recent member
  • *
  • Posts: 6

I have seen a few posts on this topic, but I haven't been able to find a solution to what I want to do, which is use  lightroom hierarchical subject tags in JRiver instead of the keywords in my photos. After reading other topics I have checked that:

The photos in the library are tagged with the hierarchicalSubject keyword, albeit in a Lightroom-specific schema.  I have looked at the raw tags in the tag editor.

My understanding is that I now need to name a custom field with exactly the same identifier as the Hierarchical keywords tag. The problem is that I'm not sure what the identifier should be: I've tried XMP:HierarchicalSubject, XMP-lr:HierarchicalSubject, h(H)ierarchical subject and a few others, but none of them work.

Can someone tell me the exact custom field identifier I need, or confirm it can't be done.

If anyone has proceeded to use the HierarchicalSubject in a viewer instead of keywords and can explain how to do that it will be even better.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42372
  • Shoes gone again!
Re: Lightroom Hierarchical Subject - How can I create a tag in j.river
« Reply #1 on: March 16, 2017, 08:03:11 am »

Is the problem that Media Center doesn't see your hierarchical keyword tags in the file?

Or does Media Center see them, but you just can't use them?

I might be more help if you'd email me a file with the tags.  I'm matt at jriver dot com.

Thanks.
Logged
Matt Ashland, JRiver Media Center

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Lightroom Hierarchical Subject - How can I create a tag in j.river
« Reply #2 on: March 16, 2017, 01:20:29 pm »

The issue I found with mine was that if the option in Lightroom to "recognise forward slash and backslash as keyword hierarchies instead of flat keywords" was turned on, then indeed, we get a nice, nested keywords list in Lightroom, as we do in MC, but...

Going the other way, from Lightroom to MC, made a real mess.

"This/is/a/keyword" became "This; is; a; keyword" even though it was shown as a hierarchy in Lightroom. I couldn't find it just now, but I was sure there was also a Lightroom option to "include the entire keyword heirarchy when exporting" or something along those lines. If not selected, only the tail end of the heirarchy is exported, and if it is enabled, all the branches are written to metadata as separate, individual keywords, which is pretty rubbish really :)

I turned the feature off in Lightroom, keeping "This/is/a/keyword" as a single flat keyword so that when exported to MC, the keywords came in nested, the way I want them.

I'll keep an eye on this with interest. If there's no sample file by tomorrow morning, I'll try and make one with a temp lightroom library.

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Lightroom Hierarchical Subject - How can I create a tag in j.river
« Reply #3 on: March 17, 2017, 01:25:22 am »

Morning Matt,

I've imported a file to lightroom that contains the following keywords:

!Events/Rome 2017
!Places/Rome

Now, with Lightroom set to recognise the slash as an heirarchical separator, here's what I get in Lightroom's keywording panels:

Keywords applied:
Rome 2017
Rome

While in the keywords list, they are nested:
!Events > Rome 2017
!Places > Rome

I then added a "Test Group" to the list, and added a "Test Keyword" inside that group and applied it to the file.

By default, Lightroom sets all groups and containing keywords to be saved in the file when exporting. This can be turned off, but at a tag at a time, tedious, no?

So when exported, the IPTC keywords become:
!Events, !Places, Rome, Rome 2017, Test Group, Test Keyword

Unless there's something in the XMP data that can be used to rebuild the heirarchy, I don't see a way around this, hence the reason my Lightroom keywords list is full of forward slashes. I can live with this because I generally only edit in Lightroom, then export to MC where all the cataloguing happens. If I was more Lightroom orientated though, I might find this difficult to live with.

I've sent you a PM with a dropbox link to an archive that contains an original and export, it's just over 3Mb
It seems that on export, Lightroom removes the <MJMD> tag block, which is rather rude :)

-marko

GlennAlt

  • Recent member
  • *
  • Posts: 6
Re: Lightroom Hierarchical Subject - How can I create a tag in j.river
« Reply #4 on: March 18, 2017, 01:52:26 am »

Thank you both for responding on this. My original post was probably not clear enough.

I use Lightroom for photo editing and cataloguing. It is the master catalogue, and I would like for MC to be able to browse the pictures I have exported to the MC library by their hierarchical keywords.  i.e. to import the tags in the files into the MC library and do whatever processing is required, by custom fields or an equivalent, to be able to browse hierarchically.

So I will always be going from a file exported from Lightroom, containing hierarchical values in the XMP:HierarchicalSubject, to MC. Never from MC to Lightroom.

I will send a file to Matt with the keywords. I don't have any problem with the keywords being generated properly, in a Lightroom sense. They are in a proprietary format containing | characters in the hierarchy, that would certainly need to be modified to be meaningful to MC. My initial problem is that I cannot import the hierarchical values into MC. My next problem is to find a way to convert the value to a meaningful MC hierarchy. I presume that can be performed using the scripting language once I have the tag in the MC catalogue. My final problem will be to use the MC-friendly hierarchy to view the media. I think the problems become progressively easier.

Thanks again for your responses. Let me know if you can enlighten me further.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Lightroom Hierarchical Subject - How can I create a tag in j.river
« Reply #5 on: March 18, 2017, 02:39:47 am »

Got you now.

Matt, at the end of the XMP tag block, there's this:
Code: [Select]
lr
hierarchicalSubject[1] !Events|Rome 2017
hierarchicalSubject[2] !Places|Rome
hierarchicalSubject[3] Test Group|Test Keyword

The "Tag()" function is not finding them using "=tag(XMP: hierarchicalSubject[1])"

Could MC be made to parse these? Maybe automatically replacing the pipes with back slashes and adding them to [Keywords].
Maybe just getting the data into an MC library field would be enough, then we could do some magic with "tag on import" rules?

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Lightroom Hierarchical Subject - How can I create a tag in j.river
« Reply #6 on: March 24, 2017, 02:42:24 am »

This is coming soon. I've been playing around with it a bit, and think I have a nice solution for you that uses tag on import rules, so the familiar Lightroom heirarchy should then be available within MC as soon as the files get imported.

I'm still playing around with it to see if I can break it, but, after falling at the first few hurdles, I reckon I'm getting somewhere quite useful with what we have at the moment.

Let me know when you have build 22.0.87 or later and, providing I haven't blown my image testing library to kingdom come in the meantime, I'll post you through it. Looking promising so far though....

GlennAlt

  • Recent member
  • *
  • Posts: 6
Re: Lightroom Hierarchical Subject - How can I create a tag in j.river
« Reply #7 on: March 25, 2017, 03:17:32 am »

Thanks very much for your efforts on this. Much appreciated.

I will upgrade and let you know when I have 22.0.87 or later.
Logged

GlennAlt

  • Recent member
  • *
  • Posts: 6
Re: Lightroom Hierarchical Subject - How can I create a tag in j.river
« Reply #8 on: March 25, 2017, 03:24:47 am »

Hi Marko, I have installed 22.0.88, which looks like it has the patch.

I'll have a further look tomorrow.

Do I need to just refer to the tag, or is there anything else ?
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Lightroom Hierarchical Subject - How can I create a tag in j.river
« Reply #9 on: March 25, 2017, 04:37:14 am »

There are many ways to get there, so that I don't get over-complicated or unnecessary, do you mind if I figure out how you do some things first?

When I export from Lightroom to MC, I export to a folder that MC 'watches' so that the exported files are automatically imported. Is this how you do it?
Are you familiar with adding fields to your MC library?
Do you want separate "Keywords" and "Lightroom Heirarchy" fields?
When you export, do you have the Lightroom metadata export option to "write keywords as Lightroom heirarchy" checked?

GlennAlt

  • Recent member
  • *
  • Posts: 6
Re: Lightroom Hierarchical Subject - How can I create a tag in j.river
« Reply #10 on: March 25, 2017, 09:22:08 pm »

Hi Marko

Thanks again. Responses inline:

There are many ways to get there, so that I don't get over-complicated or unnecessary, do you mind if I figure out how you do some things first?

When I export from Lightroom to MC, I export to a folder that MC 'watches' so that the exported files are automatically imported. Is this how you do it? Yes, I do it that way
Are you familiar with adding fields to your MC library? Yes, I have added a couple of calculated fields
Do you want separate "Keywords" and "Lightroom Heirarchy" fields?  Not necessarily. If the hierarchy can be automagically converted to nested keywords great. I assumed it would be a two pass process.

When you export, do you have the Lightroom metadata export option to "write keywords as Lightroom heirarchy" checked?. Yes, I do. I have checked the metadata in the exported photos and the hierarchies are correct
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Lightroom Hierarchical Subject - How can I create a tag in j.river
« Reply #11 on: March 26, 2017, 10:08:54 am »

When I export from Lightroom to MC, I export to a folder that MC 'watches' so that the exported files are automatically imported. Is this how you do it? Yes, I do it that way
For exported files already in your library, you would need to update manually. For future automatic imports, you can set up 'tag on import' rules that will do this automatically for you. Instructions for both procedures are outlined below.

Are you familiar with adding fields to your MC library? Yes, I have added a couple of calculated fields
Excellent. To get up and running, you will need to add a couple of fields. Details are outlined below.

Do you want separate "Keywords" and "Lightroom Heirarchy" fields?  Not necessarily. If the hierarchy can be automagically converted to nested keywords great. I assumed it would be a two pass process.
You can get to nested MC keywords in one pass. I've played quite a bit with it now. Results are excellent.

When you export, do you have the Lightroom metadata export option to "write keywords as Lightroom heirarchy" checked?. Yes, I do. I have checked the metadata in the exported photos and the hierarchies are correct
Yup. I have tested this both ways, and as well as the export heirarchy option being checked, all levels of the Lightroom heirarchy also need to be set to "include on export" and "Export containing keywords"

The steps below might take longer to read than to actually set up. I went a bit verbose to try and be clear for everyone who might be interested here. I also think it's important that, rather than just following a set of instructions, people understand exactly what they're asking MC to do with this setup.

Basically, all the ramble below arrives at is the addition of two library fields and a couple of 'tag on import' rules.

OK, so here we go with the how and a little bit of "why" where necessary.

1. Make two new library fields. I called them Lightroom and Lightroom to Keywords.
    1a. [Lightroom]
          When adding this, name it Lightroom, and if you are as OCD as me, set the 'Plural' to be Lightroom too, as "Lightrooms" is just not right!
         

    1b. [Lightroom to Keywords]
          This will be a calculated field. The expression will be, simply, =[Keywords]. If copying and pasting, take all the red text.
         

Make sure you can see these fields, and the keywords field, in your tag window. You will notice that if a file has existing keywords data, this is reflected in the "Lightroom to Keywords" field also. For now, do not try and edit the "Lightroom to Keywords" field. Read the "Why" section below first.

In step 2, we will set up the "Tag on import" rules, but before we do that, you must read, and understand, the following. If anything is not clear, either ask, or proceed with caution and use test files so you can see what's happening. After reading and understanding, you will be well placed to make your choice about how you want to proceed.

The "Why"
Before setting up auto import rules, we need to think about some things.

From Lightroom:
From my limited and recent testing, I have found that, when using a keyword heirarchy in Lightroom, the exported IPTC keywords (which MC reads by default) written by Lightroom are really just a jumbled mess of all the heirarchy headings, and their base keywords, in alphabetical order. I found this both distracting and disappointing. However, if, when exporting, you have the metadata option to "write keywords as Lightroom heirarchy" checked, then we get a nice "HierarchicalSubject" data block in the XMP tag that retains the keyword tree as it is displayed in Lightroom. In my limited testing, I found that sometimes, this heirarchy data was not present in XMP, but, with the export option checked, it has always been there.

MC can now read that data.

This might change in the future, but, for now, it can only read this data if the user specifically asks for it.
We can do this manually after importing the files into MC, or we can set up "Tag on import" rules to have the data read automatically at the time of importing.
We need to think about where we want this data stored, and whether or not we want it imported automatically when MC imports the files.

We could...
a. import to a field set up to exclusively receive and display this data.
b. import to MC's default 'Keywords' field.
c. both of the above.

"a" is a bit of a no-brainer, and it's why we created the "Lightroom" field earlier.

"b" needs more thought...
Auto import will not over write the contents of list type fields, it will only append to existing data. However, we can work around this limitation.
In my experience, the files exported from Lightroom using a keyword heirarchy have a complete mess of keywords (maybe I'm not using it correctly or optimally?), and having the heirarchy appended, means everything is now duplicated in the keywords field, albeit with one set of duplicates neatly organised in a tree. I want the heirarchy tree to replace the existing keywords data, in a way that MC can interpret, and so display the tree in the keywords pane, but, only if Lightroom heirarchy data exists. This is why we created the "Lightroom to Keywords" field earlier, and now, I'll explain that in more detail...

Lightroom to Keywords:
We set this field as a calculated field.
You should see that if you have existing Keywords data, it is reflected in this new field we created using the simple expression =[Keywords].
The cleverness comes from the fact that if you edit the contents of this field, your edits will propogate on to the real Keywords field. Yes, it works in reverse too, which is very handy.
Knowing this, our options are becoming clearer.
Either manually or automatically, we can bring the Lightroom data into the "Lightroom" field.
Either manually or automatically, we can bring the Lightroom data into the "Lightroom to Keywords" field, which in turn replaces any existing "Keywords" data with the "Lightroom" data.

Have a think. Something to consider here is that the assumption is made that we are dealing with files you exported personally and so are familiar with the contained metadata. If you also import images from unknown third parties, it's possible that these could potentially contain differring IPTC keywords and Lightroom heirarchy data which could, depending on your choices, cause the IPTC keywords to be replaced by the Lightroom heirarchy. Make your choice, and read on through "2"....

2. Importing the Lightroom heirarchy data into the MC library:

2a: Manually:
Manually is a pain, but also a necessary one if you have previously imported files that you know contain Lightroom heirarchy data and you want to get it out of files and into your library.
You could, of course, forgo the exclusive "Lightroom" library field if you wanted, but personally, despite forcing my data into "Keywords", I've kept the exclusive field too. It's not going to do any harm, and makes auto import a little easier to follow. When copying the expressions, be sure to catch all of the red text.

Manual import of Lightroom heirarchy:
In the tag window, click on the Lightroom field to open it for editing and enter the following expression:
=replace(Tag(XMP: HierarchicalSubject),|,\)

Lightroom uses a pipe "|" to define the heirarchy levels.
MC uses a back slash "\" to define its heirarchy levels.

The expression imports the heirarchy data, replacing the pipes with back slashes.
Go to a view that contains your image files, and add the "Lightroom" pane to it to see the Lightroom heirarchy reproduced in your MC library.

Manual replacement of existing Keywords data with Lightroom heirarchy:
Assuming you have the "Lightroom" field above:
In the tag window, click on the "Lightroom to Keywords" field to open it for editing and enter the following expression:
=[Lightroom]

If you don't want the Lightroom field at all, and want to pass directly to Keywords, enter the following expression instead:
=replace(Tag(XMP: HierarchicalSubject),|,\)

Manually appending Lightroom heirarchy to existing Keywords data:
Assuming you have the "Lightroom" field above:
In the tag window, click on the "Lightroom to Keywords" field to open it for editing and enter the following expression:
=[keywords];[Lightroom]

If you don't want the Lightroom field at all, and want to pass directly to Keywords, enter the following expression instead:
=[keywords];replace(Tag(XMP: HierarchicalSubject),|,\)

2b: The magic of "Tag on Import":
"Tag  on Import" is a wonderful MC feature. Using it, we can automate all or any of the above manual steps.

Open MC's options (press ctrl+o), type auto-import into the search field at the bottom, and click on "Configure auto-import"
Find your "Pictures" folder in the list, or add the folder you export to if it is not listed. Select it, and press the "Edit" button.

In the lower section, titled "Apply these tags (optional)", we add the rules we want. The order is very important here.

The first thing we will do is bring the data into the Lightroom field.
Click the "Add" button.
Pick "Lightroom" from the list of fields at the top.
Enter the following expression into the "Value" field:
=replace(Tag(XMP: HierarchicalSubject),|,\)
Press "OK"

Next, we want to replace any existing keywords with this Lightroom data, but, only if there is Lightroom data to replace it with. If we run this, and there is no Lightroom data, we will only succeed in deleting all existing keywords data, and we don't want to do that, so we test for it first. If there is no Lightroom data, do nothing, otherwise, replace the keywords.

Press the "Add" button again, and this time, choose "Lightroom to Keywords" from the list of fields.
Enter the following expression into the "Value" field:
if(isempty([Lightroom,0]),[keywords,0],replace(Tag(XMP: HierarchicalSubject),|,\))
Make sure that "Skip for files that already have a value in this field" is not checked.

OK your way all the way out, export some files from Lightroom for MC to auto-import and let me know if I missed anything.

I've read this over at least three times and I think it's complete. If it's what you want, you should now know what you're doing, and why you're doing it.
If it doesn't work, it will be because one of us missed something. Just reply here and we'll figure it out. It does appear to work, I have it working a treat here, and have tried to break it in many different ways, without success.

Replacing one set of data with another always makes people nervous. Using these steps, the only time I can see 'accidental' data loss is if importing images from a third party source that contain unexpected Lightroom heirarchy data. If I missed any other possibilities, please let me know so that I can review the instructions above.

If you would like to learn more about expressions and their possibilities, there are pages of info and examples on the wiki.

Hope that helps a bit,
-marko

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Lightroom Hierarchical Subject - How can I create a tag in j.river
« Reply #12 on: March 28, 2017, 01:09:45 pm »

I've been doing some more with this over the weekend and today, and have to say, it's feeling bullet proof so far.

Thanks to GlennAlt for asking, and Matt for the feature addition, we can now get nested keywords in both Lightroom and MC.

Brilliant.

GlennAlt

  • Recent member
  • *
  • Posts: 6
Re: Lightroom Hierarchical Subject - How can I create a tag in j.river
« Reply #13 on: March 29, 2017, 04:48:00 am »

I've just tried this, and it works perfectly. I've been wanting something like this for years !

Thank you both very much.

This has been my first experience on the forum, and I have been thrilled with the responsiveness, helpfulness and courtesy of the MC team. I hope this will be seen as a useful feature, but it is quite niche, and I appreciate your help in implementing it in MC, and greatly improving my photo browsing experience.

Great work.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Lightroom Hierarchical Subject - How can I create a tag in JRiver
« Reply #14 on: October 14, 2022, 11:34:18 pm »

I know it's been a while, but here's another tip some might find useful...

When I import into Lightroom, I always rename the files to reflect the photographer along with an ever increasing number. Mine use MARKW_12345 for example. This avoids filename clashes when importing photos provided by other people or from other cameras using the same filenaming system.

When doing this, Lightroom saves the original filename, which I thought was pretty neat, and even better, when exporting, that info is right there, in the xmp tag. Sometimes, it can be useful to know the original filename...

Create a new MC library field called "Original Filename" then set up a tag on import rule:
=tag(xmp: PreservedFileName)

Then forget about it. When the day comes you need to know the original filename of a photo, it will be there there, and you will be happy :)

-marko
Pages: [1]   Go Up