How do I create my own tag group?

Started by Jom, October 13, 2019, 09:40:49 PM

Previous topic - Next topic

StarGeek

Quote from: Andrei Korzhyts on October 14, 2019, 02:22:31 PM
1. All cameras record time zone in same format or formats may differ (e.g. +07:00, 0700...)?

The format is shown.  + or -, 2 digits for the hour offset, 2 digits for the minute offset.

Quote2. I can't use + and : in filename, so I'd better create my own timezone tag? My format is only f0700, b0700 (f, b — forward, backward).

Any particular reason you can't use a + sign?  AFAIK, it's a valid character for Windows, Linux, and Mac.

And I don't understand what the filename has to do with where you save the timezone.  Do you mean using the tag to name the files?  If so, then it's easy to get it to your format.  If you set OffsetTimeOriginal to the correct timezone, then in your command to rename files, use this:
${OffsetTimeOriginal;s/://g;s/\+/f/;s/-/b/}
It will remove the colon : and change the plus sign + to f and the minus sign - to b.

Your rename command would end up something like this
exiftool -d %Y%m%d_%H%M%S "-filename<${DateTimeOriginal}_${OffsetTimeOriginal;s/://g;s/\+/f/;s/-/b/}_${Make}${Model}...

* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Jom

#16
QuoteThe format is shown.  + or -, 2 digits for the hour offset, 2 digits for the minute offset.

I understand that.  :)
I'm just not sure if all cameras adhere to same standard and time zone will be recorded same format.
I can't check all cameras, so I ask if anyone has encountered different formats of timezone in different cameras?
For example, different cameras record fractions of a second in different formats with different accuracy.

QuoteAny particular reason you can't use a + sign...

It is very long to explain, and it is very difficult for me to tell the details in English.
In short, I create a rule system for naming and storing photo files.
Almost ready prerelease, which for me then translate on English and I'll post an his on this forum for discuss, if someone wants.
Started writing about it here — https://exiftool.org/forum/index.php/topic,10299.0.html

Quote${OffsetTimeOriginal;s/://g;s/\+/f/;s/-/b/}

Yeah, I thought of that, too.
If I'm not the only one thinking that, it's probably a good option.
I'm not good at metadata design and don't even know what questions to ask, only know what I want to get at the end.

Jom

QuotePersonally, I add it to all the places...

Can you copy me this command?
I know how to replace the value for OffsetTimeOriginal, but I don't know how to append the time zone to other date/time tags.

StarGeek

DateTimeOriginal should automatically be set by the camera.  Set OffsetTimeOriginal manually.  Then use the SubSecDateTimeOriginal to copy to any other tag you might want to.

For example, after making sure the above two tags are set,
exiftool "-IPTC:DateCreated<SubSecDateTimeOriginal" "-XMP:DateTimeOriginal<SubSecDateTimeOriginal" "-XMP:DateCreated<SubSecDateTimeOriginal" "-IPTC:TimeCreated<SubSecDateTimeOriginal" "-GPS:GPSDateStamp<SubSecDateTimeOriginal" "-GPS:GPSTimeStamp<SubSecDateTimeOriginal" <DIR>

My actual command is much shorter because I use a Shortcut tag I defined, but the idea is the same.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Jom

While I was waiting for an answer, I created this command:

exiftool -progress: -progress -overwrite_original -r -OffsetTime=+03:00 -OffsetTimeOriginal=+03:00 -OffsetTimeDigitized=+03:00 *.cr2

Next I do so:

exiftool -progress: -progress -r -d "%Y/%Y%m%d/%Y%m%d_%H%M%S" "-FileName<D:\${DateTimeOriginal}_${OffsetTimeOriginal;s/\+/f/;s/-/b/;s/://}_${Model;s/ //g}_${InternalSerialNumber}_${FileName}" *.cr2

But you do differently.
Why? I didn't think everything through?

StarGeek

Quote from: Andrei Korzhyts on October 14, 2019, 07:37:30 PM
But you do differently.

Must be a problem in translation.  You're example is adding time zone to the filename, which should work as you want.  But your other question was
Quote from: Andrei Korzhyts on October 14, 2019, 05:24:58 PM
I don't know how to append the time zone to other date/time tags.

My answer was to show how to add the time zone to other date/time tags.  My example was not an attempt to add time zone to the filename.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Jom

Quoteexiftool -progress: -progress -overwrite_original -r -OffsetTime=+03:00 -OffsetTimeOriginal=+03:00 -OffsetTimeDigitized=+03:00 *.cr2

Quoteexiftool "-IPTC:DateCreated<SubSecDateTimeOriginal" "-XMP:DateTimeOriginal<SubSecDateTimeOriginal" "-XMP:DateCreated<SubSecDateTimeOriginal" "-IPTC:TimeCreated<SubSecDateTimeOriginal" "-GPS:GPSDateStamp<SubSecDateTimeOriginal" "-GPS:GPSTimeStamp<SubSecDateTimeOriginal" <DIR>

It seems we a bit about different things write. I understood.
You change the date/time content by supplementing it with a time zone, and I don't, I add the time zone to a separate tag?

Jom

QuoteMy answer was to show how to add the time zone to other date/time tags.

I understand, thanks.
You add a timezone not with a special command (e.g. using regular expressions), you add a timezone using an intermediate composite tag?

StarGeek

Quote from: Andrei Korzhyts on October 14, 2019, 07:57:13 PM
You add a timezone not with a special command (e.g. using regular expressions), you add a timezone using an intermediate composite tag?

That is correct.  It may take a bit longer as it takes two passes, but it is less prone to user error.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Jom


Phil Harvey

Quote from: Andrei Korzhyts on October 14, 2019, 11:11:59 AM
1; #end — This is necessary?

It is necessary that the config file returns true.  By convention, including this as the last statement in the file guarantees this.

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

Jom

QuoteIt is necessary that the config file returns true.  By convention, including this as the last statement in the file guarantees this.

I don't know Perl yet, but I've already found the answer.

https://www.google.ru/search?newwindow=1&source=hp&ei=jielXdz4NsWIrwStoqvoAQ&q=perl+1%3B&oq=perl+1%3B&gs_l=psy-ab.3..0l4j0i22i30l6.3054.5485..6414...0.0..0.212.650.6j0j1......0....1..gws-wiz.......0i10.6VHDGuFf-io&ved=0ahUKEwjc9_D2lJ3lAhVFxIsKHS3RCh0Q4dUDCAU&uact=5

Thanks for the answer anyway.