andrewning / sortphotos

SortPhotos is a Python script that organizes photos and videos into folders using date/time information
1.03k stars 310 forks source link

select tag with the most timestamp information #111

Open jaakkopoyry opened 5 years ago

jaakkopoyry commented 5 years ago

Hi Andrew,

I really like how sort-photos evaluates a file for the oldest date in the exif data prior to sorting & renaming based on my chosen naming format. Hoping you can assist with something.

I have three images below (detailed photo exif info at the bottom of this note): naming format: %Y-%m-%d%H%M%SDESCRIPTOR 00045.jpg got renamed 2000-09-13114550DESCRIPTOR.jpg as it's oldest date value was "2000:09:13 11:45:50", no name conflicts there. 00132.jpg got renamed 2000-09-13120000DESCRIPTOR.jpg as it was the first file with the "2000:09:13 12:00:00" timestamp. again, no name conflicts there. 00133.jpg got renamed 2000-09-13120000DESCRIPTOR_11.jpg since the filename "2000-09-13__120000___DESCRIPTOR.jpg" already existed.

If image 00133.jpg could utilize tag "Composite:SubSecCreateDate": "2000:09:13 12:00:00.189", the resulting filename could potentially become 2000-09-13__120000189___DESCRIPTOR.jpg instead, negating the need for the "_40" to differentiate.

Questions: 1) Can sort-photos select & use the tag containing the most timestamp information? e.g. "Composite:SubSecCreateDate" 2) Can sort-photos rename utilizing all of the digits in the longest tag? (I was able to do it directly with exiftool and the ${subsectime} value, but I find exiftool's syntax quite complex; sort-photos is much clearer.) 3) If these features are not present in sort-photos currently, can they be added?

Thanks.

Detailed photo information: 00045.jpg
"SourceFile": "/Users/jaakopoyry/Desktop/sortphotos_test_4/00045.jpg", "File:FileModifyDate": "2000:09:13 11:45:50-04:00", "File:FileAccessDate": "2019:01:21 18:05:45-05:00", "File:FileInodeChangeDate": "2019:01:21 18:05:34-05:00", "EXIF:ModifyDate": "2000:09:13 20:21:40", "EXIF:DateTimeOriginal": "2000:09:13 11:45:50", "EXIF:CreateDate": "2000:09:13 11:45:50", "IPTC:DateCreated": "2000:09:13", "IPTC:TimeCreated": "11:45:50-05:00", "Composite:DateTimeCreated": "2000:09:13 11:45:50-05:00"

00132.jpg "SourceFile": "/Users/jaakopoyry/Desktop/sortphotos_test_4/00132.jpg", "File:FileModifyDate": "2000:09:13 12:00:00-04:00", "File:FileAccessDate": "2019:01:21 18:05:29-05:00", "File:FileInodeChangeDate": "2019:01:21 18:05:34-05:00", "EXIF:ModifyDate": "2000:09:13 21:02:24", "EXIF:DateTimeOriginal": "2000:09:13 12:00:00", "EXIF:CreateDate": "2000:09:13 12:00:00", "EXIF:SubSecTime": 185, "EXIF:SubSecTimeOriginal": 185, "EXIF:SubSecTimeDigitized": 185, "IPTC:DateCreated": "2000:09:13", "IPTC:TimeCreated": "12:00:00-05:00", "Composite:DateTimeCreated": "2000:09:13 12:00:00-05:00", "Composite:SubSecCreateDate": "2000:09:13 12:00:00.185", "Composite:SubSecDateTimeOriginal": "2000:09:13 12:00:00.185", "Composite:SubSecModifyDate": "2000:09:13 21:02:24.185"

00133.jpg "SourceFile": "/Users/jrb8/Desktop/sortphotos_test_4/00133.jpg", "File:FileModifyDate": "2000:09:13 12:00:00-04:00", "File:FileAccessDate": "2019:01:21 18:11:09-05:00", "File:FileInodeChangeDate": "2019:01:21 18:05:34-05:00", "EXIF:ModifyDate": "2000:09:13 21:02:24", "EXIF:DateTimeOriginal": "2000:09:13 12:00:00", "EXIF:CreateDate": "2000:09:13 12:00:00", "EXIF:SubSecTime": 189, "EXIF:SubSecTimeOriginal": 189, "EXIF:SubSecTimeDigitized": 189, "IPTC:DateCreated": "2000:09:13", "IPTC:TimeCreated": "12:00:00-05:00", "Composite:DateTimeCreated": "2000:09:13 12:00:00-05:00", "Composite:SubSecCreateDate": "2000:09:13 12:00:00.189", "Composite:SubSecDateTimeOriginal": "2000:09:13 12:00:00.189", "Composite:SubSecModifyDate": "2000:09:13 21:02:24.189"

andrewning commented 5 years ago

Sorry for the delayed reply. I only review this repo when I dump off my photos and that isn't very often. No, it doesn't currently try to figure out which timestamp is longer. They are so many permutations of renaming preference that people have that I haven't really tried to wade into that.