Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timewarp pull-exif timezone fails to update Photos Timezone info when offset_seconds == 0 #1703

Closed
oPromessa opened this issue Oct 7, 2024 · 0 comments

Comments

@oPromessa
Copy link
Contributor

Before submitting a bug report, please ensure you are running the most recent version of osxphotos and that the bug is reproducible on the latest version

osxphotos --version
osxphotos, version 0.68.6
Python 3.11.5 (main, Aug 24 2023, 15:23:30) [Clang 14.0.0 (clang-1400.0.29.202)]
macOS 12.7.6, x86_64

Describe the bug

When EXIF based offset is 0 (in the case of GTM timezone), the date time gets pulled from the file EXIF into Photos database but not the offset/timezone.

I believe issue would be here: when `dtinfo.offset_seconds is valid (not None) and equals 0 for GMT offset, this test fails

if dtinfo.offset_seconds:

I believe it should be:

    if dtinfo.offset_seconds is not None:

To Reproduce

$ exiftool -a -G1 -s -api QuickTimeUTC=1 -time:all -api RequestAll=2 -*offset* file.JPG
[ExifTool]      Now                             : 2024:10:07 17:26:58+01:00
(...)
[ExifIFD]       DateTimeOriginal                : 2019:07:21 23:37:38
[ExifIFD]       CreateDate                      : 2019:07:21 23:37:38
[ExifIFD]       OffsetTime                      : +00:00
[ExifIFD]       OffsetTimeOriginal              : +00:00
[ExifIFD]       OffsetTimeDigitized             : +00:00
(...)
[Composite]     SubSecCreateDate                : 2019:07:21 23:37:38+00:00
[Composite]     SubSecDateTimeOriginal          : 2019:07:21 23:37:38+00:00
[Composite]     SubSecModifyDate                : 2019:07:21 23:37:38+00:00
[Composite]     GPSDateTime                     : 2019:07:21 23:37:38Z
[Composite]     DateTimeCreated                 : 2019:07:21 23:37:38+00:00
[Composite]     DigitalCreationDateTime         : 2019:07:21 23:37:38+00:00
[ExifIFD]       OffsetTime                      : +00:00
[ExifIFD]       OffsetTimeOriginal              : +00:00
[ExifIFD]       OffsetTimeDigitized             : +00:00

$ osxphotos timewarp -c
filename, uuid, photo time (Photos), photo time (EXIF), timezone offset (Photos), timezone offset (EXIF)
file.JPG, A7D2E1C0-2DEB-4B72-8BB1-98749EC6C44C, 2019-07-22 01:37:38, 2019-07-21 23:37:38, +0200, +0000

$ osxphotos timewarp --pull-exif --verbose 
exiftool path: /usr/local/bin/exiftool
⚠️  About to process 1 photo with timewarp. This will directly modify your 
Photos library database using undocumented features. While this functionality 
has been well tested, it is possible this may corrupt, damage, or destroy your
Photos library. Use at your own caution. No warranty is implied or provided. 
It is strongly recommended you make a backup of your Photos library before 
using the timewarp command (for example, using Time Machine).

Proceed with timewarp? [y/N]: y
Updating Photos from EXIF data for file.JPG (A7D2E1C0-2DEB-4B72-8BB1-98749EC6C44C)
Updated date/time for photo file.JPG (A7D2E1C0-2DEB-4B72-8BB1-98749EC6C44C): 2019-07-22 00:37:38
Done.
  • Side Note: The date time indicated by pull-exif is 2019-07-22 00:37:38 (localised as per the following code line) and not 2019:07:21 23:37:38 as per EXIF data.
    local_datetime = datetime_remove_tz(

Expected behavior
Consider the offset == 0 case.

Screenshots
N/A
Desktop (please complete the following information):

osxphotos --version
osxphotos, version 0.68.6
Python 3.11.5 (main, Aug 24 2023, 15:23:30) [Clang 14.0.0 (clang-1400.0.29.202)]
macOS 12.7.6, x86_64

Additional context
Working on a PR 😄 !

oPromessa added a commit to oPromessa/osxphotos that referenced this issue Oct 7, 2024
…update Photos Timezone info when offset_seconds
oPromessa added a commit to oPromessa/osxphotos that referenced this issue Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants