Open StevenACoffman opened 2 years ago
photos_time_warp should be able to handle this situation already as it does have a --pull-exif option. You'll need to install exiftool to use it as photos_time_warp uses exiftool to read the EXIF data.
Hmmm... I keep getting:
│ /usr/local/Cellar/python@3.10/3.10.1/Frameworks/Python.framework/Versions/3. │
│ 10/lib/python3.10/_strptime.py:349 in _strptime │
│ │
│ 346 │ │ │ _regex_cache[format] = format_regex │
│ 347 │ found = format_regex.match(data_string) │
│ 348 │ if not found: │
│ ❱ 349 │ │ raise ValueError("time data %r does not match format %r" % │
│ 350 │ │ │ │ │ │ (data_string, format)) │
│ 351 │ if len(data_string) != found.end(): │
│ 352 │ │ raise ValueError("unconverted data remains: %s" % │
│ │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ arg = '%Y:%m:%d %H:%M:%S' │ │
│ │ data_string = '0000:00:00 00:00:00' │ │
│ │ format = '%Y:%m:%d %H:%M:%S' │ │
│ │ format_regex = re.compile('(?P<Y>\\d\\d\\d\\d):(?P<m>1[0-2]|0[1-9]|[1-9… │ │
│ │ [1-9])\\s+(?P<H>2[0-3]|[0-1]\\d|\\d):(?P<M>[0-5]\\d|\\d)… │ │
│ │ re.IGNORECASE) │ │
│ │ found = None │ │
│ │ index = 1 │ │
│ │ locale_time = <_strptime.LocaleTime object at 0x141bb3700> │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
ValueError: time data '0000:00:00 00:00:00' does not match format '%Y:%m:%d
%H:%M:%S'
A bit before that:
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ default_time = False │ │
│ │ dt = '0000:00:00 00:00:00' │ │
│ │ dt_str = 'EXIF:DateTimeOriginal' │ │
│ │ exif = { │ │
│ │ │ 'SourceFile': '/Users/cofjak/Pictures/Photos │ │
│ │ Library.photoslibrary/originals/D/D7A7FA79-6D37-4E'+25, │ │
│ │ │ 'ExifTool:ExifToolVersion': 12.3, │ │
│ │ │ 'File:FileName': │ │
│ │ 'D7A7FA79-6D37-4E24-B6DF-7A0B60765D4F.jpeg', │ │
│ │ │ 'File:Directory': '/Users/cofjak/Pictures/Photos │ │
│ │ Library.photoslibrary/originals/D', │ │
│ │ │ 'File:FileSize': 2334598, │ │
│ │ │ 'File:FileModifyDate': '2008:12:31 23:00:00-05:00', │ │
│ │ │ 'File:FileAccessDate': '2021:12:20 12:14:51-05:00', │ │
│ │ │ 'File:FileInodeChangeDate': '2021:11:27 │ │
│ │ 20:09:42-05:00', │ │
│ │ │ 'File:FilePermissions': 100644, │ │
│ │ │ 'File:FileType': 'JPEG', │ │
│ │ │ ... +105 │ │
│ │ } │ │
│ │ matched = <re.Match object; span=(0, 19), match='0000:00:00 │ │
│ │ 00:00:00'> │ │
│ │ offset = None │ │
│ │ offset_seconds = None
Not sure if it is relevant, but:
2022-01-06 22:17:51,067 - WARNING - photosdb.py - 106 - WARNING: This module has only been tested with macOS versions [10.12, 10.13, 10.14, 10.15, 10.16, 11.0, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6]: you have Darwin, OS version: 12.1
What's the output of:
exiftool -alldates /Users/cofjak/Pictures/Photos\ Library.photoslibrary/originals/D/D7A7FA79-6D37-4E24-B6DF-7A0B60765D4F.jpeg
Thanks so much for your help!
$ exiftool -alldates /Users/cofjak/Pictures/Photos\ Library.photoslibrary/originals/D/D7A7FA79-6D37-4E24-B6DF-7A0B60765D4F.jpeg
Date/Time Original : 0000:00:00 00:00:00
Create Date : 0000:00:00 00:00:00
Modify Date : 0000:00:00 00:00:00
I think this is fixed in v0.1.6. Update and see if it's working now. I couldn't test it as exiftool wouldn't let me create a date with invalid year/month/day as your image has Date/Time Original: 0000:00:00 00:00:00
This fixed the vast majority of my 60K pictures! I am so grateful for your work and help!
For the remaining 1K pictures that had no EXIF information or an invalid date, I have an old backup on an old mac from before I told apple photos to "manage my file locations" so the timestamps are correct there. I can select them manually on the new computer and run the photos_time_warp for every single photo... but before I spend a few hours doing that, I wondered if you have any other suggestions.
It's not clear to me what you mean about the remaining photos. Do you have an old backup of the entire Photos library or just the photos themselves? If it's a backup of the Photos library itself, it sounds like the photos are in a separate directory (e.g. they're referenced files) not copied into the Photos library ("before I told apple photos to "manage my file locations" ") If so, is this also the case on the new computer? Or are they managed by Photos on the new computer? I can think of a couple of ways to possibly automate this but need to understand the actual situation.
Edit: one other question -- do the images all have unique names or is there a chance some have duplicate names. E.g. if imported from multiple cameras, you could have two images named something like IMG_1234.JPG
.
I would like to selectively pull from the EXIF information of the original image files to restore their original date/timestamp in Photos.
I let my daughter use an old camera with a dead battery, so the EXIF information had all the timestamps set to the factory default (January 1st, 1970 00:00:00 UTC) when she went to import them. She used ⌘A (which selected ALL photos, not just those from the camera), and set them to the current date. Somehow Apple Photos set the oldest photo to and then added time so we now have pictures well into 2073.
I would like to fix this situation by using photos_time_warp if possible.