From f285678fdfeb4b41c1770e30045680e184a0ed21 Mon Sep 17 00:00:00 2001 From: MSP Date: Mon, 7 Oct 2024 19:37:11 +0100 Subject: [PATCH] Proposed fix for #1730 --- osxphotos/exif_datetime_updater.py | 2 +- osxphotos/exifutils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osxphotos/exif_datetime_updater.py b/osxphotos/exif_datetime_updater.py index 0671ff248..949c46cd0 100644 --- a/osxphotos/exif_datetime_updater.py +++ b/osxphotos/exif_datetime_updater.py @@ -178,7 +178,7 @@ def update_photos_from_exif( ) return None - if dtinfo.offset_seconds: + if dtinfo.offset_seconds is not None: # update timezone then update date/time timezone = Timezone(dtinfo.offset_seconds) tzupdater = PhotoTimeZoneUpdater( diff --git a/osxphotos/exifutils.py b/osxphotos/exifutils.py index c1bd0e7f6..c579c4539 100644 --- a/osxphotos/exifutils.py +++ b/osxphotos/exifutils.py @@ -97,7 +97,7 @@ def get_exif_date_time_offset( # try to get offset from EXIF:OffsetTimeOriginal offset = exif.get("EXIF:OffsetTimeOriginal") or exif.get("OffsetTimeOriginal") - if dt and not offset: + if dt and offset is None: # see if offset set in the dt string for pattern in ( r"\d{4}:\d{2}:\d{2}\s\d{2}:\d{2}:\d{2}([+-]\d{2}:\d{2})", @@ -122,7 +122,7 @@ def get_exif_date_time_offset( offset_seconds = exif_offset_to_seconds(offset) if offset else None if dt: - if offset: + if offset is not None: # drop offset from dt string and add it back on in datetime %z format dt = re.sub(r"[+-]\d{2}:\d{2}$", "", dt) dt = re.sub(r"\.\d+$", "", dt)