Determine if a NikonCapture block is present

Started by Hayo Baan, August 29, 2016, 02:29:11 PM

Previous topic - Next topic

Hayo Baan

Hi Phil,

What is the best way (via the API) to determine if a file contains a NikonCapture block? It is irrelevant which tags are present in the block, I just need to know if the NikonCapture block is present or not.
Hayo Baan – Photography
Web: www.hayobaan.nl

Phil Harvey

I would say test the NikonCaptureData tag, but you will have to request this tag by name to be sure it is extracted.

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

Hayo Baan

Hi Phil, I haven't tested this with the API, but on the command line this doesn't work. Even if the block is available, testing with e.g. '-if $NikonCapture' didn't work. I had to use e.g, a tag inside the block for this to work (which I don't want to do as the tag might not be there all the time). '-if $NikonCapture:all', however, does  work too so I guess I am actually looking for the API version of this :)
Hayo Baan – Photography
Web: www.hayobaan.nl

Phil Harvey

Hi Hayo.  Not "NikonCapture".  Try "NikonCaptureData" as I mentioned.

The API version of $NikonCapture:all would be tricky.

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

Hayo Baan

Quote from: Phil Harvey on August 30, 2016, 07:15:55 AM
Hi Hayo.  Not "NikonCapture".  Try "NikonCaptureData" as I mentioned.

Doh, should have read your reply better ::)
Looks like this will work as I intended, great!

Quote from: Phil Harvey on August 30, 2016, 07:15:55 AM
The API version of $NikonCapture:all would be tricky.
Nah, NikonCaptureData will do, I think. So for my full understanding, I guess NikonCaptureData is the tag inside the makernotes which you then further analyse and synthesise into separate NikonCapture tags?

Thanks,
Hayo
Hayo Baan – Photography
Web: www.hayobaan.nl

Phil Harvey

Quote from: Hayo Baan on August 30, 2016, 10:41:43 AM
Nah, NikonCaptureData will do, I think. So for my full understanding, I guess NikonCaptureData is the tag inside the makernotes which you then further analyse and synthesise into separate NikonCapture tags?

Correct.  Directory-type tags like this that are accessible as blocks have a "Writable" type other than "-" in the Tag Name documentation.

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

Hayo Baan

Excellent, just one further question. In my script I want to delete the block, but when I set the value to undef, I get the following error: "Sorry, MakerNotes:NikonCaptureData is unsafe for writing", what's the solution for this?
Hayo Baan – Photography
Web: www.hayobaan.nl

Phil Harvey

If you're calling SetNewValue(), you must call it with Protected => 1 to be able to write unsafe tags.

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

Hayo Baan

Right, I knew I missed something... Probably read about this in the past, but forgot ::)
Hayo Baan – Photography
Web: www.hayobaan.nl