Modify of tags with language sub-tags

Started by herb, October 09, 2011, 11:48:33 AM

Previous topic - Next topic

herb

Hello Phil,

On my windows system I did some tests with tags that have also language depending subtags ; like xmp:rights.
I worked with Exiftool version 8.65.

1) As I do not know which subtags really exist inside the image file and
   as I want to be sure that only those language subtags exist which are in my private list,
   my tool generates the following part of command
        -XMP:Rights="" "-XMP:Rights-x-default<XMP:Rights-x-default" "-XMP:Rights-de<XMP:Rights-de"
        ! delete tag        ! restore base value                                         ! restore german value

2) Within the same command I want also to modify both values
    This is done with
        -XMP:Rights-x-default="new value" -XMP:Rights-de="new value"

3) At the moment my tool is not clever enough to decide that step 1 is not necessary because both restored values
    will be overwritten in step 2.

4) These 2 parts are sent to Exiftool as only 1 command.
    My problem is now that after ExifTool has executed the command the content of XMP:Rights-de is unchanged:
       XMP:Rights-de="old value"
   I had expected XMP:Rights-de also to be changed to "new value".

Running the command in DOS-box with option -v2 I get the following output:
   Rewriting XMP
     - XMP-dc:Rights-x-default = 'dere2'
     - XMP-dc:Rights-de = 'dere1'
     + XMP-dc:Rights-de = 'dere1'
     + XMP-dc:Rights-x-default = 'new value'

What do I wrong in the generated command?
Thanks for your help in advance.

Herb

Phil Harvey

Hi Herb,

I need to see your command to know what is going on. The source of your confusion is likely due to the order of operations.  Read FAQ number 22 and post your exact command here and we should be able to sort this out.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

herb

Hello Phil,

thanks for your fast reply and sorry, that I was not detailed enough.
My test-file has the content:
   -XMP:Rights="old value" -XMP:Rights-de="old value"

After I entered the command
   exiftool -XMP:Rights="" "-XMP:Rights-x-default<XMP:Rights-x-default" "-XMP:Rights-de<XMP:Rights-de"
                -XMP:Rights-x-default="new value" -XMP:Rights-de="new value"

the content of -XMP:Rights-de is unchanged.

Thanks also for your hint to FAQ 22, but I do not see that this is valid here.

I also do not see why -XMP:Rights-de is kept unchanged.
Thanks for your help in advance
Herb

Phil Harvey

Hi Herb,

With "-XMP:Rights-de<XMP:Rights-de" XMP:Rights-de is copied from the old value after all other values are assigned as per FAQ 22, so this is why the value doesn't change.  XMP:Rights-x-default changes because there is no XMP:Rights-x-default to copy in "-XMP:Rights-x-default<XMP:Rights-x-default".  (This is because you don't specify "x-default" when reading.)

To do what you want, try this:

exiftool -tagsfromfile a.jpg -XMP:Rights="" "-XMP:Rights-x-default<XMP:Rights" "-XMP:Rights-de<XMP:Rights-de" -XMP:Rights-x-default="new value" -XMP:Rights-de="new value" a.jpg

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

herb

Hello Phil,

thanks for your explanations and help.
Your command works perfect.
Although I have read FAQ #22 I did not recognize that -tagsfromfile @ is given implicitely.

I hope I have my lessions learned now.
Thanks again
Herb

Phil Harvey

Hi Herb,

Quote from: herb on October 12, 2011, 11:54:08 AM
Although I have read FAQ #22 I did not recognize that -tagsfromfile @ is given implicitely.

I have added this to the FAQ to try to avoid this confusion in the future.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).