Author Topic: Question: How to handle (automise) multiple BIB-Numbers  (Read 5639 times)

Offline Sven

  • Uber Member
  • ******
  • Posts: 1053
    • View Profile
Question: How to handle (automise) multiple BIB-Numbers
« on: August 28, 2023, 12:40:56 AM »
Hi Team,
is there a way to do CR for multiple BIBs in a single image?
I enter the start numbers shown (semicolon separated) into an unused IPTC field.

Any idea on how iterate through all BIBs shown to add their names into the IPTC description, persons shown, etc?

Idea: read the full string, look for the (defined) separator, split the string accordingly and loop through all the entries
After 5 years of absence I restarted the photography.

Offline Bob Russell

  • Camera Bits Staff
  • Sr. Member
  • *****
  • Posts: 276
    • View Profile
    • Camera Bits, Inc.
Re: Question: How to handle (automise) multiple BIB-Numbers
« Reply #1 on: August 28, 2023, 03:18:45 PM »
Hi Sven,

I was successful with a test of this workflow. I used the Headline field for the collection of Bib numbers. Each Bib number must be of the same format. I used 4 characters followed by the separator character. Eg 0011;1244;2101;3257. There shouldn't be any blank spaces or other characters in the Headline field.

The code replacement file will have two columns for the return names. The fist column of names will be used in the repeating such as Persons Shown and Keywords. Each name will be preceded with the separating character and a blank space.
Eg, 0011<tab>; Jimmy C. Bits<tab>Jimmy C. Bits<cr>

The second name column will be used in non repeating fields such as the Caption/Description. It will just have the Bib number athlete names.

Once the images have been updated with the Bib numbers following the above format, setup the Metadata (IPTC) Template with the following code replacement variables.
Repeating fields - Persons Shown :
={head:0,4}= ={head:5,4}= ={head:10,4}= ={head:15,4}= ={head:20,4}=    and so on if you plan on adding more than 5 people to the field.
Non-repeating fields - Caption/Description :
={head:0,4}#2= ={head:5,4}#2= ={head:10,4}#2= ={head:15,4}#2= ={head:20,4}#2=

The final setting to check will be in the Set Code Replacements dialog. Make sure the Default replacement character is just a single blank space. This will prevent the code replacements returning == for the empty code replacement variables.

Best regards,

--Bob
« Last Edit: October 17, 2023, 03:56:56 PM by Bob Russell »

Offline Sven

  • Uber Member
  • ******
  • Posts: 1053
    • View Profile
Re: Question: How to handle (automise) multiple BIB-Numbers
« Reply #2 on: August 28, 2023, 05:00:53 PM »
Thanks Bob,
I wasn't aware anymore that we can strip out a specific number of characters and use them for CR.

Will give it a try
After 5 years of absence I restarted the photography.

Offline Sven

  • Uber Member
  • ******
  • Posts: 1053
    • View Profile
Re: Question: How to handle (automise) multiple BIB-Numbers
« Reply #3 on: October 16, 2023, 10:00:37 PM »
Bob,
is it "normal" that some fields (see screenshot) are adding additional spaces automatically?
I pasted everywhere the same string "2211;2349;2348" and saved the IPTC data.
Is there a list somewhere which fields are handling the text as "plain" text?
After 5 years of absence I restarted the photography.

Offline Sven

  • Uber Member
  • ******
  • Posts: 1053
    • View Profile
Re: Question: How to handle (automise) multiple BIB-Numbers
« Reply #4 on: October 16, 2023, 10:43:46 PM »
another strange thing:

CR-file (tab delimited):
Code: [Select]
2349 Steffen JUSTUS (DE) text1 text2 JUSTUS, Steffen text3
2211 Raphael JUNGHANS (DE) text1 text2 JUNGHANS, Raphael text3
2284 Sven EHRHARDT (DE) text1 text2 EHRHARDT, Sven text3

Alt-Text in IPTC: 2349;2211;2284
CR-String in Persons Shown: +{alttext:0,4}#5+; +{alttext:5,4}#5+; +{alttext:10,4}#5+;

Expected result: JUSTUS, Steffen; JUNGHANS, Raphael; EHRHARDT, Sven
Actual result: JUSTUS, Steffen,JUNGHANS, Raphael; EHRHARDT, Sven

I have no idea where the comma (instead of the the semicolon and space) comes from
This happens as well in description writers, keywords and some others.
After 5 years of absence I restarted the photography.

Offline ahoward

  • Camera Bits Staff
  • Hero Member
  • *****
  • Posts: 971
    • View Profile
Re: Question: How to handle (automise) multiple BIB-Numbers
« Reply #5 on: October 16, 2023, 10:44:40 PM »
Yes, it is normal. The data is still stored in the metadata as you entered it, a space is simply added when displaying the contents of that field.

The fields where this will happen are the ones that have a "+" checkbox next to them in the metadata template.

Offline Sven

  • Uber Member
  • ******
  • Posts: 1053
    • View Profile
Re: Question: How to handle (automise) multiple BIB-Numbers
« Reply #6 on: October 16, 2023, 10:56:01 PM »
Yes, it is normal. The data is still stored in the metadata as you entered it, a space is simply added when displaying the contents of that field.

The fields where this will happen are the ones that have a "+" checkbox next to them in the metadata template.

But a CR on this field does not work as expected as the additional space will be evaluated, too:
the same numbers entered into {scene} and applied the CR to persons shown:
CR in Persons Shown: ; +{scene:0,4}#5+; +{scene:5,4}#5+; +{scene:10,4}#5+
Result: JUSTUS, Steffen,+ 221#5+; +; 22#5+
After 5 years of absence I restarted the photography.

Offline Bob Russell

  • Camera Bits Staff
  • Sr. Member
  • *****
  • Posts: 276
    • View Profile
    • Camera Bits, Inc.
Re: Question: How to handle (automise) multiple BIB-Numbers
« Reply #7 on: October 17, 2023, 04:24:25 PM »
Hi Sven,

  My trick for the multiple code replacements in a single field only works if the code replacement variables are used in a repeating field ( These are the fields with the + checkbox in the IPTC Metadata Template ).  The reason this will only work in these special fields is due to how Photo Mechanic treats a leading separator character and a blank space. Any leading separator character in a repeating field will just be removed. The same is also true for leading blank spaces.

  In your sample code replacement text file, I did not see the leading separating character followed by a blank space, before the names. This workflow requires a separating character and a space before each name in the line.

   In the Metadata Template, the Bib numbers do not need to be separated by a semicolon character. I used a blank space between each code replacement variable in the field.
 
In the IPTC Info dialog, if you have the 4 digit Bib number followed by a blank space and repeat for all of the Bib numbers, then you should be able to use most of the IPTC dialog fields as the Bib number field.

Best regards,

--Bob

Offline ahoward

  • Camera Bits Staff
  • Hero Member
  • *****
  • Posts: 971
    • View Profile
Re: Question: How to handle (automise) multiple BIB-Numbers
« Reply #8 on: October 24, 2023, 03:42:49 PM »
another strange thing:

CR-file (tab delimited):
Code: [Select]
2349 Steffen JUSTUS (DE) text1 text2 JUSTUS, Steffen text3
2211 Raphael JUNGHANS (DE) text1 text2 JUNGHANS, Raphael text3
2284 Sven EHRHARDT (DE) text1 text2 EHRHARDT, Sven text3

Alt-Text in IPTC: 2349;2211;2284
CR-String in Persons Shown: +{alttext:0,4}#5+; +{alttext:5,4}#5+; +{alttext:10,4}#5+;

Expected result: JUSTUS, Steffen; JUNGHANS, Raphael; EHRHARDT, Sven
Actual result: JUSTUS, Steffen,JUNGHANS, Raphael; EHRHARDT, Sven

I have no idea where the comma (instead of the the semicolon and space) comes from
This happens as well in description writers, keywords and some others.
Just to clarify on this, regardless of any workarounds, it does seem like a comma is being placed where it shouldn't be, and it only seems to happen when using substring extraction from the same field multiple times, and only for the first separator. While this probably needs to be fixed, it feels like there might be an easier to to accomplish what you are trying to do. Have you looked into hot codes? https://docs.camerabits.com/support/solutions/articles/48000358684-hot-codes