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

Proposed fix for #1703 #1705

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion osxphotos/exif_datetime_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions osxphotos/exifutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})",
Expand All @@ -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)
Expand Down
Loading