APP REQUEST "Add incremental time stamp to a selection of files"

Started by hluxem, July 11, 2017, 01:24:57 AM

Previous topic - Next topic

hluxem

Hello all,
I have one Imatch 5 script I use quite a bit when adding older media files to my database. The script allows me to place the files on the timeline and maintaining a manual sort sequence. It modifies the timestamps of scanned pictures and imported movie files with the date set to the capture date. To maintain the sort sequence, I increment the time stamp from file to file. This cannot be done with meta data templates.
The images are sorted and selected before running the script. The Imatch 5 script brings up a dialogue asking for the initial date and time, time zone and the increment for the selection of images. The timestamp requires a certain format. For the old script I just used a text box and had to make sure I typed the date, time and time zone correctly or the script would fail. The first file is set to the initial date and time, for each subsequent file the increment is added to the time stamp. I updated the following tags for the image selection. This covered any image and movie file I had and put it on the correct spot in the time line. If needed, Imatch will create xmp files for certain file types like mp4 movie files.
XMP::photoshop\DateCreated\DateCreated\0     yyyy:mm:dd hh:mm:ss+hh:mm
XMP::xmp\CreateDate\CreateDate\0      yyyy:mm:dd hh:mm:ss+hh:mm

Background:
I do have quite a collection of scanned slides and negatives as well as super 8 and Hi8 movie clips. I want to be able to see them in the timeline in the right sequence.
My first step to create a time stamp is to look for files with known dates. Sometimes the files are marked with a full or partial date, sometimes a special event like a weddings or holiday gives me a clue. Then I sort all files to the next known or estimated date. The script sets the timestamp for the first file and adds an increment for each of the next files. This increment can be selectable, I usually use 10 s or 1 min. That allows me to insert new files later without changing the time stamp of existing files in the database. 
This actually works for me much better than I initially expected. I have been able to do this for some of my files, but it's an ongoing project and there are still many more waiting to be processed. I was able to copy and paste the Imatch 5 script together, but the new scripting is way beyond my abilities.

Thanks,

Heiner


Mario

Wouldn't that be easier to achieve with the Renamer and a properly sequenced file name? In that case your sort order would even be correct in software which does cannot read the EXIF timestamp. The Renamer has all the features for that built-in.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Happy to work on a script for this Heiner - appreciate a new concrete example.  As Mario states, you can probably achieve this through the standard functionality - but it will be a good exercise for me anyway.  I will review the request in more detail and see if I have any questions.

If you can provide a quick screenshot of your current script - that would be most helpful for me to recreate.  Thx again! - Andy.

hluxem

QuoteWouldn't that be easier to achieve with the Renamer and a properly sequenced file name?

In order to see the images at the right place in the time line I will have to write a time stamp to the files no matter what. I just choose to increment the timestamp rather than writing the same time stamp to a number of files. I do not have to rename my files when I process them in Imatch. Other software will not work anyhow because these are files in different folders and only Imatch gives me the freedom to display files independent of folder structure.

Andy,

Thanks for looking at this. Attached is a screen shot of the dialog.
There is one check box "Date Time from file". I used this to extract the date and time out of a file name as some of some of my movie files ended up with date and time in the name. This is not needed anymore as I think this can be done with a metadata template. The script is also posted here:
https://www.photools.com/community/index.php?topic=4477.0


Thanks,

Heiner


Jingo

Thx Heiner - I will review this weekend and see what I can come up with.. thx for the script too - I can review to ensure I am coding it correctly in JS.  Stay tuned!!

Jingo

Hi Heiner - I am all done with the incremental time stamp app... I just want to do some more detailed testing and then I will upload the app tomorrow.

Happy to have app #3 complete!  Stay tuned....

hluxem

Hello Andy,

That's great. Let me know if there is anything you want me to test.

Thanks,

Heiner

Jingo

Ok all.. this script is now all set!  To install, unzip the archive into your webroot/user directory. This can normally be found at %PROGRAMDATA%\photools.com\imatch6\webroot\user

Here we go with the details:

   


Here are the details of the application... The starting Exif Date & Time will be for the Focused Image.  If you have multiple images to update - the focused image is still the one that will be used as the starting point.

Focused Filename: shows the filename of the focused file from the File Selection window
Exif Date & Time of Focused Image: show the date created timestamp of the focused file
Total Selected Images: shows the total number of images in the Selection window
Do Timestamps Match?: checks the timestamps for all the files to see if they are an exact match - if not - provides a visual indicator

Increment time for each Image by:  Allows the user to enter in a value to adjust the timestamp of all selected images
Minute/Second option buttons: Indicates to either increment the selected images by minutes or seconds (used in conjunction with the "Increment time for each Image by"  box)

New Date & Time after Increment: shows the value of the timestamp after the above increment is applied - this value will be applied to all selected images.

Write New Time Stamp to Images button: files the new timestamp back to the selected Images.


Values should update as the focused image is changed in the selector window.  Also, the new date & time should update as the increment text box is adjusted and/or the minute and second button values are changed.

For those App Developers out there - there is some cool JS code to manipulate dates included in the file... I used the Moment.js library to do some date/time calculations which could be helpful to others that may need to manipulate dates and times in their code.  Also, there is some nice JS /HTML code that shows how to check for field values as well as code that demonstrates how to perform updates to fields based upon changes to other fields.  Cool stuff! 

As for all my apps, I heavily documented each group of functions to help others learn... Please let me know if you notice any questions or issues...

Enjoy! - Andy.

hluxem

Hello Andy,

Thank you very much for doing this, I really appreciate it. Needless to say I could have never done that.
I finally had some time to work with it and look at the code.
The app works a little different then what I need, all files got the same timestamp.  I wanted a different time stamp for each file like below:
increment 1 s   with 9 files
file 1:   1999-04-06T01:04:00
file 2:   1999-04-06T01:04:01
.
.
file 9:   1999-04-06T01:04:09

Naive as I was, that looked like an easy modification and I felt challenged to learn a little bit about the new scripting. So I started to play with the script.  Phew, I wonder if learning Chinese is easier than learning to script with these modern languages. I certainly miss a lot of the basics. After some long nights, I finally had success in finding a way to write back the time stamp for each file using some code from the Sample App Metadata. I'm not sure what the proper way is to edit the forms, I copied and pasted in the editor and got it looking ok. It seems there is a better way/tool to place/size text, boxes and buttons, but I don't know where to start.
I did add an input field for the initial time stamp and the time zone as I can't use the time stamp of the focused file. Both fields are text boxes and I give them an initial value. If the field is modified in the wrong way, it may not be in the correct format for a date anymore. That's not a problem for me and I have no idea how I could check if the returned value is in the proper date format.
My version of the script is attached.

Thanks again,

Heiner


Jingo

Thx Heiner - sorry I misunderstood but I'm glad in a way that is enabled you to get in there and start coding a bit!

I'll take a peek at the code and make the modifications to the master app as well.... makes sense that  you would want all the names to differ slightly!