Is it possible to use the CSV to update metadata in tags from a custom XMP schema

Started by Rachel, June 02, 2024, 12:33:53 AM

Previous topic - Next topic

Rachel

Hello, I'm attempting to import changes to metadata with a CSV in a similar way, but the tags are in a custom XMP schema. When running the exiftool (exiftool -G1) on the file, I confirm the tag is "Jersey" and the group is "XMP-attsnSchema". Is it possible to use the CSV to update metadata in tags from a custom XMP schema? I'm on Windows 10 using this method on folders of PNG files. Thank you.


[XMP-attsnSchema] Position                      : 1B
[XMP-attsnSchema] Jersey                        : 29

StarGeek

The problem wouldn't be the CSV import part. The problem would be that you need to create a definition for your custom XMP.  Exiftool cannot arbitrarily create tags that it doesn't have a definition for.

See the example.config file on how to create custom XMP.
"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

Rachel

#2
Thank you. I've created a config file as seen below. I went through a few "config file not found" and syntax errors that were resolved. However, it still leaves the images unchanged. Any tips?


command:

exiftool -config "path_to_config_file" -csv="path_to_csv" -overwrite_original "path_to_folder_of_pngs"


csv example:

SourceFile,Jersey,Position
"filepath",29,1B
"filepath",-,-
"filepath",28,3B


config file:

# Define a custom XMP namespace
%Image::ExifTool::UserDefined::Main = (
    GROUPS => { 0 => 'XMP', 1 => 'XMP-main', 2 => 'Image' },
    NAMESPACE => { 'attsnSchema' => 'http://my.attsnSchema.namespace/' }
);

# Define custom tags within the custom namespace
%Image::ExifTool::UserDefined::Main::Tags = (
    'attsnSchema:Jersey' => {
        Name => 'Jersey',
        Writable => 'string',
        Description => 'Jersey'
    },
    'attsnSchema:Position' => {
        Name => 'Position',
        Writable => 'string',
        Description => 'Position'
    }
);

Phil Harvey

You weren't very close with your attempt.  This should work:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::Main' => {
        attsnSchema => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::attsnSchema',
            },
        },
    },
);

%Image::ExifTool::UserDefined::attsnSchema = (
    GROUPS        => { 0 => 'XMP', 1 => 'XMP-attsnSchema', 2 => 'Image' },
    NAMESPACE     => { 'attsnSchema' => 'http://my.attsnSchema.namespace/' },
    WRITABLE      => 'string', # (default to string-type tags)
    Jersey => {
        Name => 'Jersey',
        Description => 'Jersey',
    },
    Position => {
        Name => 'Position',
        Description => 'Position',
    },
);

1;  #end

But note that the Name and Description elements are not necessary since they are both the same as the tag ID.

- 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 ($).