ivandokov / phockup

Media sorting tool to organize photos and videos from your camera in folders by year, month and day.
MIT License
847 stars 108 forks source link

Look for key that includes time zone info (for Apple Live Photos) #218

Closed BigCheeZ closed 10 months ago

BigCheeZ commented 1 year ago

I changed the logic in selecting a date string to prefer a date with time zone information. I did this to support my use case which includes Apple Live Photos. I use the 'boredazfcuk/icloudpd' docker image for downloading my images from iCloud. I want to use phockup to reorganize them since I decided to change my organization scheme. An issue I noticed is that the picture and video portions of a live photo have different keys and info in the keys. In particular, the video file exif data appears to use UTC time except for a single field. That field is 'Creation Date'. The video also has 'Create Date' but it is UTC time. This has lead to phockup putting the picture file in one date directory and the video in another for Live Photos when the UTC time is on a different date than the time zone set for the phone.

Example snippets.

Live Photo picture portion (eg: img0.HEIC):

Create Date                     : 2023:07:12 20:50:25.330-07:00

Live Photo video portion (eg: img0_HEVC.MOV).

Create Date                     : 2023:07:13 03:50:25
Creation Date                   : 2023:07:12 20:50:25-07:00

I see there is another PR that may be trying to solve this problem in a different way.

https://github.com/ivandokov/phockup/pull/208

ivandokov commented 10 months ago

@BigCheeZ, as you mentioned #208 is tackling the same issue but I think the implementation there is better and unfortunatelly I'll close your PR but thank you for the effort! Further PRs are welcome!

BigCheeZ commented 10 months ago

This note is just for posterity. The logic in this PR was not enough to work for my needs. The reason being that sometimes the date with timezone information was not accurate. I had some older images where the correct time was recorded, but the timezone was not recorded in the date. The file modified date was much newer (it was the current date when I exported the image) and since it did have the timezone information, my branch of the code was incorrectly choosing that file-modification date instead of the actual date when the image was captured.