Config for EmbyCollections tag

Started by CasaAtardecer, April 18, 2025, 03:02:16 PM

Previous topic - Next topic

CasaAtardecer

Hello forum, I have spent days and weeks researching how to define a jpg metadata tag to conform to Dublin Core, and trying dozens of different config and exiftool commands, but have not been successful.

The purpose of the Dublin Core in the XMP is because of the parsing requirements of a media server tool I am using for media called Emby.

I am attempting to load a custom metadata tag that will parse to a tag used by Emby that they have titled 'embycollections'.

The Emby required embedded xml code for my tags is shown below and the administrators at Emby have pointed out that my code which does not contain the 'bag' or 'li' coding is mismatched when compared to their parsing rules for Dublin Core XMP subject and XMP title metadata, which all work perfectly fine.

I have tried so many different combinations of config text that I am having trouble remembering what I have tried and what I have not tried. I turned 60 recently and I guess I am having a little trouble remembering the iterations.

Would anyone in this thread have any interest or time to point me in the right direction?

Thank you in advance. -Gregg

<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 12.54'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>

<rdf:Description rdf:about=''
  xmlns:dc='http://purl.org/dc/elements/1.1/'>

  <dc:embycollections>
  <rdf:Bag>
    <rdf:li>MyCollection1</rdf:li>
    <rdf:li>MyCollection2</rdf:li>
  </rdf:Bag>
  </dc:embycollections>
 
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>

StarGeek

Can you show us the config file you have created so far?
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

CasaAtardecer

Hello friend,
Thank you for your interest and reply.
The config.txt file I created was from the Exiftool forum regarding adding a user-defined tag and it looks like this:
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::dc' => {
        embycollections => {  },
    },
);

1;
The exiftool cmd I used was also from the Exiftool forum and it looks like this:
exiftool -config "m:\config.txt" -xmp-dc:embycollections="Collection1" filename.jpg -overwrite_original
The resulting xml exported from my filename.jpg contains the following xml:
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 12.54'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
 <rdf:Description rdf:about=''
  xmlns:xmp='http://ns.adobe.com/xap/1.0/'>
  <xmp:embycollections>Collection1</xmp:embycollections>
 </rdf:Description>
</rdf:RDF>
</x:xmpmeta>
According to the folks at Emby, it does not conform to their Dublin Core standard namespace tag to parse into their Emby Collections because it does not look like the sample they provided.
Interestingly, the developer at Emby is unable or unwilling to conduct a test of the metadata tag or provide to me a sample of a photo that was successfully parsed into the field they say will accept the metadata tag, provided the xml is written correctly.
I have researched online, trying to teach myself how to write xml directly to a jpg to try to emulate the correct xml code containing the 'dc' and the 'bag' and the 'li' coding, but so far, I am just not getting anywhere.
Any words of advice or a link to an article where I can do more research and learn more would be greatly appreciated.
Again, thank you for your interest.

StarGeek

This config file creates a tag that is a simple string and the example XMP in your first post shows that the tag is a List Type tag. A List Type tag is a tag that can have multiple entries that are saved completely separated from the others, as shown by the two <rdf:li> entries.

In example.config file, you would look at Example #10 as a source

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::dc' => {
        embycollections => {  List => 'Bag' },
    },
);

1;

Example. Using this config file and then dumping the XMP data shows the result is nearly identical to your example XMP.
C:\>exiftool -config embycollections.config -P -overwrite_original -embycollections=MyCollection1 -embycollections=MyCollection2 y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -b -xmp y:\!temp\Test4.jpg
<?xpacket begin='�' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 13.27'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>

 <rdf:Description rdf:about=''
  xmlns:dc='http://purl.org/dc/elements/1.1/'>
  <dc:embycollections>
   <rdf:Bag>
    <rdf:li>MyCollection1</rdf:li>
    <rdf:li>MyCollection2</rdf:li>
   </rdf:Bag>
  </dc:embycollections>
 </rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end='w'?>
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

StarGeek

Here's an optional edit that will prettify the output but won't change the data. If you change the embycollections line to look like this
embycollections => {  List => 'Bag', Name => 'EmbyCollections' },Then the output will look like this
C:\>exiftool -config embycollections.config -Embycollections y:\!temp\Test4.jpg
Emby Collections                : MyCollection1, MyCollection2

C:\>exiftool -config embycollections.config -Embycollections -s y:\!temp\Test4.jpg
EmbyCollections                 : MyCollection1, MyCollection2

The first is the tag description, which separates the two words, with the actual tag name has a capital C to show the separation.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

CasaAtardecer

Hurrah! The missing piece of coding, that I was unable to riddle out on my own and you were so generous to write out for me, was the key that unlocked the door!
List => 'Bag'I cannot tell you how your advice and guidance and sharing the code has changed my photo archiving world!
The exiftool cmd structure you wrote out for me below is a little bit more understandable for me, so I used that one.
C:\>exiftool -config config.txt -P -overwrite_original -embycollections=GroupA -embycollections=GroupB file.jpgThe one piece of the exiftool cmd that was completely new to me was the "-P" which I have researched to learn that it is an instruction to "preserve" the filemodifydate. Is that correct? I like it.
Your generosity did not end with the newly written config text and exiftool cmd: You went on to offer an alternative edit. I must confess that the optional edit you provided is one step too far for me, because there are things happening there that I am not yet familiar with. Nevertheless, I absolutely appreciate you cracking the code for me!
I successfully inserted multiple entries into the metadata list for EmbyCollections, even ones that were multiple words encased in double quotes!
The edited photo metadata is being parsed so successfully by Emby that I am like a dog with two tails!
Thank you for helping me out.
Cheers!

StarGeek

Quote from: CasaAtardecer on April 21, 2025, 01:00:20 AMThe one piece of the exiftool cmd that was completely new to me was the "-P" which I have researched to learn that it is an instruction to "preserve" the filemodifydate. Is that correct?
\

Yes, see the docs on the -P (-preserve) option. And the -overwrite_original option suppresses the creation of backup files. So make sure your files are backed up before using it.

QuoteYou went on to offer an alternative edit. I must confess that the optional edit you provided is one step too far for me, because there are things happening there that I am not yet familiar with.

The extra edit is purely aesthetic. It simply adds a capital C to the tag name/description and a space to the tag description.  See FAQ #2.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype