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

On import consider GPS Location from XMP if EXIF is not available. #912

Merged
merged 3 commits into from
Jan 16, 2023
Merged
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
4 changes: 4 additions & 0 deletions osxphotos/cli/import_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,17 @@ def location_from_file(
latitude = -latitude
elif latitude_ref != "N":
latitude = None
if latitude is None:
latitude = metadata.get("XMP:GPSLatitude")
if longitude := metadata.get("EXIF:GPSLongitude"):
longitude = float(longitude)
longitude_ref = metadata.get("EXIF:GPSLongitudeRef")
if longitude_ref == "W":
longitude = -longitude
elif longitude_ref != "E":
longitude = None
if longitude is None:
longitude = metadata.get("XMP:GPSLongitude")
if latitude is None or longitude is None:
# maybe it's a video
if lat_lon := metadata.get("QuickTime:GPSCoordinates") or metadata.get(
Expand Down