Migrating namespace (Exiv2 to Exiftool)

Started by silversleevesx, January 28, 2014, 12:07:26 PM

Previous topic - Next topic

silversleevesx

Hi.

I'm a longtime Exiv2 user for whom the idea of making a "custom" namespace without a lot of typing on the command line has great appeal. While using Exiv2, I created one such that now has five XMP labels. I tried using the Exiftool_config edits in jesse's (?!) thread, but I keep getting "not available or not writeable" errors. I'll attach the relevant part of my edited config file as well as one that defines the labels in the namespace, and I'll watch this forum for replies.

BZT


silversleevesx

In case anyone's curious, or has any background or experience with Exiv2, here's what I used to do to write all five labels to a file. Pardon please the extensive use of string variables; even I can't trust my own typing.  :)


exiv2 -M"reg bztag http://ns.bztsilversleeves.com/xmpmeta0.42/" -vkM"set Xmp.bztag.DescBlock $dblock" -kM"set Xmp.bztag.LongDesecription '$longd'" -kM"set Xmp.bztag.ShortDescription $shortd" -kM"set Xmp.bztag.ThemeId $thid" -kM"set Xmp.bztag.TrueDate $truedate" $file


Phil Harvey

#2
You should start from the working version of the config file that I posted here.  The config file you posted has a couple of problems similar to the original post in that thread.

Adding the ability to specify tags via the command line would be more complicated than the config file, unless the features were significantly restricted (no XMP structures, no conversions, no conditional tags, limited metadata types, etc, etc, etc...).

- Phil

Edit: Re-reading your original post I see that you weren't advocating, but rather lamenting, the command-line custom-tag technique.
...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 ($).

silversleevesx

Phil,

I finally got what you meant, and was able to write a BZTag Short Description to one JPEG file. I followed it up by doing the Exiv2 equivalent of an -XMP:All, and got this from stdout:
     XMP.dex.shortdescription. LangAlt 1
and the Description I entered via stdin. "dex" doesn't look like "bztag". Am I still missing something?
Just FYI: still running the old versions (8.77 and 8.15, the former in this case).

BZT

Phil Harvey

If you post either your config file, or the resulting raw XMP, I may be able to answer your question.

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

silversleevesx

Phil,

I just upgraded to 9.54, so I'm attaching the config file that "worked" (as described in my last post) in 8.77 as well as the current one, older item first. The XML was generated by Exiv2, because of a new error that showed up when I tried doing so from the new Exiftool install. What was OK with the old doesn't seem as much so for the new, unless (as I suspect) I've made some other careless mistakes.

What I noticed, after editing the config file Exiftool 9.54 is using now, is that "ShortDescription" was found and written, albeit with that odd "dex" bit in Exiv2's stdout, while "LongDescription" produced a "doesn't exist or isn't writable" error. That might be a clue as to what went/is going wrong.

I hope you can set me back on the right track.

BZT

Phil Harvey

I get syntax errors with both of your config files:

> cp ~/Desktop/ExifTool_config ~/.ExifTool_config

> exiftool a.xmp -XMP-ns_1:shortdescription=test
syntax error at /Users/phil/.ExifTool_config line 311, near ");"
syntax error at /Users/phil/.ExifTool_config line 320, near ")"
Warning: Tag 'XMP-ns_1:ShortDescription' does not exist
Nothing to do.

> cp ~/Desktop/ExifTool_config-2 ~/.ExifTool_config

> exiftool a.xmp -XMP-ns_1:shortdescription=test
Useless use of a constant ("Image::ExifTool::XMP::Main") in void context at /Users/phil/.ExifTool_config line 312.
Useless use of anonymous hash ({}) in void context at /Users/phil/.ExifTool_config line 312.
Warning: Tag 'XMP-ns_1:ShortDescription' does not exist
Nothing to do.


Try the attached config file instead, with the command I gave.

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

silversleevesx

Phil,

I'm using the config file you attached to your reply. I didn't pay much attention to the command in your example, and tagged a JPEG file with a "ShortDescription" that still had the "dex" bit on it. Looking at the XMP in XnView, I see it's related to "http://ns.optimasc.com/dex/1.0/". Optima SC comes up on Google as a one-person company near Montreal with a product for Windows called Description Explorer, which does have XMP viewing and editing support as one of its several functions. I don't know how Exiftool was able to associate "shortdescription" with that namespace, but the coincidence that "where it comes from" has something to do with editing XMP amuses me somewhat.

I suppose for this one JPEG, I can use the Exiv2 namespace reg and tag remove procedure, then rewrite a more "vanilla" tag already in the file using Exiftool (for which purpose I have BASH scripts I know are good) to re-format the XMP in XnView visually.

BTW: I think the cause of the bad visual formatting of Exiv2's XMP might have something to do with the fact that every time I've compiled it, there have been XMP-related errors in the make stage.

BZT

silversleevesx

Phil,
I'm fairly sure I'm not going to be able to remember -XMP-ns_1:shortdescription=
If possible, I'd like to use something more like "-XMP-bztag:ShortDescription=" . And I think we're almost to the point where I can.
In the config file you attached to your earlier post, I noticed an 'ns_1' on the NAMESPACE line, line #20 in my own editor. Should I expect this to work if I changed that to "bztag"? Or is "bztag" too long? Or is that "ns_1" part of the mechanics of the thing, so to speak?

Like I said in an earlier post to this thread:
Quote from: silversleevesx on March 12, 2014, 04:23:18 PM
"dex" doesn't look like "bztag".
Neither does "ns_1". And as I don't use these custom XMP tags that often, but want to know when I do, I often make the IPTC Special Instructions tag into which I've written them read "File contains BZTag XMP metadata."

I could go on and on about this, but instead I'll wait for any comments, facts I'm unaware of or suggestions.

Cheers.
BZT

Phil Harvey

You choose whatever namespace prefix you want, just change "ns_1" etc in your config file.  I just kept the "ns_1" because that is what you had used.  The reason you can't just specify "ShortDescription" on the command line is because there is already another tag with that name in a different namespace.

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

silversleevesx

Phil,

It's good to hear the "ns_1" isn't crucial. I wanted to be sure before I changed it and "invited" an error.

As for "shortdescription" being in another namespace, I figured asmuch. I was just curious if you knew anything about Optima SC. Before my last post, that is.  :D

BZT

Quote from: Phil Harvey on March 18, 2014, 06:27:45 PM
You choose whatever namespace prefix you want, just change "ns_1" etc in your config file.  I just kept the "ns_1" because that is what you had used.  The reason you can't just specify "ShortDescription" on the command line is because there is already another tag with that name in a different namespace.

- Phil

silversleevesx

Phil,

Attached you'll find my config file, with ns_1's changed to "bztag" (just that way). I'm still getting "Warning:...does not exist or isn't writable" on LongDescription, though. And shortdescription still writes as Optima SC's dex. I can dream up some other name to use instead. It's not too much work to edit my "Terms and Namespace" file, after all.

What leaves me scratching my head is the "choke" on LongDescription. Am I changing too much to bztag in this config file? Not enough?

BZT

Phil Harvey

Man, are you confused.  There were a number of problems with your config file that I have corrected.  (See attachment.)

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

silversleevesx

Phil,

I just upgraded the Exiftool on my Linux laptop to 9.5.2. Using the config file you provided with your last post, I'm still getting the "doesn't exist" error on LongDescription. I was getting it in version 8.15 too. Could it be a chmod (permissions) issue? It's the same file right down to "the last jot and tiddle," as the cliche goes. Right now the perms are -rwxr-xr-x. Am I being "too nice," or "not nice enough"?

BZT

Phil Harvey

See FAQ number 11 for some help debugging your config file problems.

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