Need some help with milliseconds !

Post Reply
stevehughes
Posts: 82
Joined: 19 Jan 13 3:46
Location: Brisbane, Australia

Need some help with milliseconds !

Post by stevehughes » 20 Jun 13 0:04

Nice vague subject to attract interest :D

I've been playing around with renaming rules for a while with the aim of getting something that I can guarantee to be unique across my whole collection and (hopefully) remain unique if I add in third party files. For the last few years with my D50 I have used the rule:

SGH_%yyyy-%mm-%dd_%hh%nn%ss.%FileExtension

This worked most of the time although I would occasionally get a (001) appended. The burst capability of the D50 in RAW was limited so I rarely produced multiple shots per second.

Having added a D7100 I regularly shoots bursts and also need to deal with results from a 'two camera shoot', So I figured I would add fractional seconds and also the camera model:

SGH_%yyyy-%mm-%dd_%hh%nn%ss.%zzz{mid=1,1}_%exif:Model{word=2}.%FileExtension

This gives, for example:
SGH_2013-06-16_091656.3_D7100.NEF

Note the funny string manipulation of the milliseconds ( I could have used 'left' rather than 'mid' but I was experimenting). The milliseconds is where my problem lies. The NEFs seem to record the fractional part of seconds differently to the derived JPG. For example, for the above image I get the following results from exiftool:

RAW: Date/Time Original : 2013:05:19 09:16:56.30
JPG: Date/Time Original : 2013:05:19 09:16:56.299999232

I want my rename rule to be robust enough that I get the same result when applied to both the NEF and the derived JPG.

Is there some way to get PSU to perform a rounding function so the '.299999232' gets rounded to '.3' ? Then my worries would all disappear.

Regards,
Steve

stevehughes
Posts: 82
Joined: 19 Jan 13 3:46
Location: Brisbane, Australia

Re: Need some help with milliseconds !

Post by stevehughes » 20 Jun 13 1:20

Never mind... with a bit more thought I think I got it:

SGH_%yyyy-%mm-%dd_%hh%nn%ss.%zzz{format=%1.0e;left=1}_%exif:Model{word=2}.%FileExtension

Thanks,
Steve

mphillips
Posts: 236
Joined: 31 May 07 12:02
Location: Parkwood,Johannesburg,South Africa

Re: Need some help with milliseconds !

Post by mphillips » 20 Jun 13 7:15

Hi Steve

What I have used is the Camera Name plus Year - Month - Day - Plus Shutter Count.

Caters for burst shooting - and I have never had a duplication yet.

Just a different view / idea :-)

MikeP
Mike Phillips
http://www.mikeandmorag.co.za
D800, CNX2, Supreme

stevehughes
Posts: 82
Joined: 19 Jan 13 3:46
Location: Brisbane, Australia

Re: Need some help with milliseconds !

Post by stevehughes » 20 Jun 13 7:22

That's a rather good idea Mike. Thanks.

mphillips
Posts: 236
Joined: 31 May 07 12:02
Location: Parkwood,Johannesburg,South Africa

Re: Need some help with milliseconds !

Post by mphillips » 20 Jun 13 8:13

Hi Steve

My Renaming Rule:

Code: Select all

%code
if (AnsiSameText('%exif:Model', 'Nikon D70')) then result := 'D70_%yy%mm%dd_'+AddLeadingChars('%exifmakernote:ShutterCount', '0', 6, False)
else if (AnsiSameText('%exif:Model', 'Nikon D40X')) then result := 'D40X_%yy%mm%dd_'+AddLeadingChars('%exifmakernote:ShutterCount', '0', 6, False)
else if (AnsiSameText('%exif:Model', 'Nikon D70S')) then result := 'D70S_%yy%mm%dd_'+AddLeadingChars('%exifmakernote:ShutterCount', '0', 6, False)
else if (AnsiSameText('%exif:Model', 'Nikon D80')) then result := 'D80_%yy%mm%dd_'+AddLeadingChars('%exifmakernote:ShutterCount', '0', 6, False)
else if (AnsiSameText('%exif:Model', 'Nikon D90')) then result := 'D90_%yy%mm%dd_'+AddLeadingChars('%exifmakernote:ShutterCount', '0', 6, False)
else if (AnsiSameText('%exif:Model', 'Nikon D200')) then result := 'D200_%yy%mm%dd_'+AddLeadingChars('%exifmakernote:ShutterCount', '0', 6, False)
else if (AnsiSameText('%exif:Model', 'Nikon D300')) then result := 'D300_%yy%mm%dd_'+AddLeadingChars('%exifmakernote:ShutterCount', '0', 6, False)
else if (AnsiSameText('%exif:Model', 'Nikon D800')) then result := 'D800_%yy%mm%dd_'+AddLeadingChars('%exifmakernote:ShutterCount', '0', 6, False)
else if (AnsiSameText('%exif:Model', 'Canon EOS 350D DIGITAL')) then result := '350D_%yy%mm%dd_'+AddLeadingChars('%exifmakernote:ShutterCount', '0', 6, False)
else result := '%exif:Model_%yy%mm%dd_'+'%FileNumber';
%/code
.%FileExtension
Regards

MikeP
Mike Phillips
http://www.mikeandmorag.co.za
D800, CNX2, Supreme

weidmic
moderator
Posts: 834
Joined: 04 Dec 06 22:21

Re: Need some help with milliseconds !

Post by weidmic » 20 Jun 13 8:26

Code: Select all

%yy-%mm-%dd_%exif:Model%code Input := StrTran (Input, 'Nikon D', 'D'); %/code_%exifmakernote:ShutterCount.%FileExtension
one more renaming rule :)
PSUServer 5.x, PostgreSQL 10.x
My homepage http://www.michaelweidner.com
PSU Tips and Tricks http://www.michaelweidner.com/WP/psu/

stevehughes
Posts: 82
Joined: 19 Jan 13 3:46
Location: Brisbane, Australia

Re: Need some help with milliseconds !

Post by stevehughes » 20 Jun 13 8:31

Thanks Mike,

Even though PSU doesn't do quite everything that I would like, it certainly has renaming by the short-and-curlies !

Steve.

stevehughes
Posts: 82
Joined: 19 Jan 13 3:46
Location: Brisbane, Australia

A case of sheer delight !

Post by stevehughes » 22 Jun 13 21:55

Hi Mike,

Your previous post caused the penny to drop, and I finally realised that PSU's scripting is just Delphi code. So I dug out my dusty programming skills from a past life and came up with a renaming rule that will parse the multi-word Model name and drop in a short descriptor for those models I know / care about (basically just choosing which word carries the most useful info). Just posting it here for the benefit of anyone who comes looking for examples.

Code: Select all

SGH_%yyyy-%mm-%dd_%hh%nn%ss-%zzz{format=%1.0e;left=1}%code

case '%exif:Model{word=1}' of
   'NIKON', 'Nikon' : result := '_%exif:Model{word=2}'
   'CANON', 'Canon' : result := '_%exif:Model{word=3}'
   'KODAK', 'Kodak' : case '%exif:Model{word=2}' of
                         'EASYSHARE' : result := '_%exif:Model{word=3}'
                          else result := '_%exif:Model{word=2}'
                      end
   'FinePix'        : result := '_%exif:Model{word=2}'
   ''               : result := ''
   else result := '_%exif:Model{word=1}'
end

%/code.%FileExtension
Cheers,
Steve

stevehughes
Posts: 82
Joined: 19 Jan 13 3:46
Location: Brisbane, Australia

Re: Need some help with milliseconds !

Post by stevehughes » 22 Jun 13 22:08

weidmic wrote:

Code: Select all

%yy-%mm-%dd_%exif:Model%code Input := StrTran (Input, 'Nikon D', 'D'); %/code_%exifmakernote:ShutterCount.%FileExtension
one more renaming rule :)
Thanks weidmic. Looks to me that renaming rules can be as simple or complex as required.

Level 1 - just pick the required functions from the drop-downs
Level 2 - edit the text and add parameters (which unfortunately I have to refer back to the IDI help for - the PSU help seems very 'thin')
Level 3 - drop in %code and %/code, then write whatever you want !

Love it.

David Grundy
Posts: 241
Joined: 13 May 07 16:40
Location: Hong Kong

Re: Need some help with milliseconds !

Post by David Grundy » 23 Jun 13 6:19

Hmmm, when I was asking about help for scripting a while ago I never realised we were talking about Delphi; I was wondering how other people seemed to know something about the syntax. I only realised it quite recently. Perhaps a thought for Hert - when scripting is mentioned in the documentation or elsewhere, it may be useful to mention "Delphi".

Anyway, not a language I know anything about and I really have no time to learn!
weidmic wrote:

Code: Select all

%yy-%mm-%dd_%exif:Model%code Input := StrTran (Input, 'Nikon D', 'D'); %/code_%exifmakernote:ShutterCount.%FileExtension
one more renaming rule :)
This doesn't work for me, either for Canon- or Olympus- derived DNG files. I just get literally nothing (no characters in the output file name) from this:

Code: Select all

%exifmakernote:ShutterCount
Is this code specific to Nikon?

... David

tstoddard
Posts: 578
Joined: 07 Sep 12 12:51

Re: Need some help with milliseconds !

Post by tstoddard » 23 Jun 13 14:57

David,

I'm not sure about this but I think PSU only supports Nikon and Canon makernotes. I'm not sure why or where I got that impression but I believe makernotes are very proprietary so supporting all makers could get pretty difficult. Perhaps Hert can confirm.
Last edited by tstoddard on 23 Jun 13 21:24, edited 1 time in total.
Tom Stoddard

weidmic
moderator
Posts: 834
Joined: 04 Dec 06 22:21

Re: Need some help with milliseconds !

Post by weidmic » 23 Jun 13 20:55

David,

can you share a imagefile, just snap a shot of a wall or whatever?

Regards,
Michael
PSUServer 5.x, PostgreSQL 10.x
My homepage http://www.michaelweidner.com
PSU Tips and Tricks http://www.michaelweidner.com/WP/psu/

David Grundy
Posts: 241
Joined: 13 May 07 16:40
Location: Hong Kong

Re: Need some help with milliseconds !

Post by David Grundy » 24 Jun 13 14:19

Happy to share an ORF or a DNG (both have the same result with the renaming rule). As I can't upload such a large file to the forum, is there somewhere I can send it?
Thanks for pursuing this.
... David

weidmic
moderator
Posts: 834
Joined: 04 Dec 06 22:21

Re: Need some help with milliseconds !

Post by weidmic » 24 Jun 13 15:39

David,
there are several free "file sharing" services out there...
I use dropbox a lot.

Regards,
Michael
PSUServer 5.x, PostgreSQL 10.x
My homepage http://www.michaelweidner.com
PSU Tips and Tricks http://www.michaelweidner.com/WP/psu/

Post Reply