ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: Piergi on September 16, 2011, 03:47:53 PM

Title: Adding support for Creative Commons XMP tags
Post by: Piergi on September 16, 2011, 03:47:53 PM
Hi to all.

I was trying to add copyright information to my files using the xmp file provided by Creative Commons web site: http://creativecommons.org/choose/metadata.xmp?license_code=by-nc-sa&jurisdiction=&version=3.0&lang=en

Unfortunately, there are a few tags that exiftool reads but cannot write. I get the error `Warning: Rights is not a structure!' when trying to write through the -TagsFromFile option, and `Tag 'RightsA' does not exist' (for the three tags) if trying to write the content of a cvs file.

The tags provided by CC are these:

$ exiftool -xmp:all CC_Attribution-NonCommercial-ShareAlike_3.0_Unported.xmp
Marked                          : True
Rights A Rel                    : license
Rights A Href                   : http://creativecommons.org/licenses/by-nc-sa/3.0/
Rights A                        : Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
License                         : http://creativecommons.org/licenses/by-nc-sa/3.0/

The three `Rights A' tags are the offending ones, I guess because they are referring to some unspecified structure.

I don't know if one should add them as `custom fields', seen that they are *not* custom but existing and used by CC.

Seen that CC licenses are pretty common (no pun intended), would it be possible to add support for those three tags?
Also, is it possible to add them as-is without overwriting the whole xmp block? (I guess one could add the picture xmp information to the CC .xmp file, then copying this whole new block as-is to the picture. I don't remember the option now, but I'm sure I saw it!)

Thank you very much,
Piergi
Title: Re: Adding support for Creative Commons XMP tags
Post by: Phil Harvey on September 16, 2011, 05:37:47 PM
Hi Piergi,

Very interesting, but the problem is that the file you downloaded from CC is not valid XML.  You should report this to the CC since it is their bug.

The XML specification says that the greater-than and less-than characters must be escaped within string values.  This must be done for the dc:rights value in their XMP file:

     <rdf:Description rdf:about=''
      xmlns:dc='http://purl.org/dc/elements/1.1/'>
      <dc:rights>
       <rdf:Alt>
        <rdf:li xml:lang='x-default' >This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License</a>.</rdf:li>
       </rdf:Alt>
      </dc:rights>
     </rdf:Description>


- Phil
Title: Re: Adding support for Creative Commons XMP tags
Post by: Piergi on September 17, 2011, 07:30:31 AM
Thank you very much! I should have noted it myself . . .
I wrote to CC explaining the bug.

Then I corrected (with &lt; and &gt;) the offending instances, but I am not fully sure of the use of putting HTML tags into metadata: none of the applications I have tried can interpret it. I guess if one uploads files to some metadata-aware web service it will work, I haven't tried though.

Thanks for the quick reply, it is a pleasure writing in this forum :-)

Cheers,
Piergi