Skip to content

Commit

Permalink
On import consider GPS Location from XMP if EXIF is not available. (#912
Browse files Browse the repository at this point in the history
)

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

On import consider GPS Location from XMP if EXIF is not available. Relevant for MOV file types without EXIF.

* Revert "On import consider GPS Location from XMP if EXIF is not available."

This reverts commit 5d0dc82.

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

Relevant for MOV files which do not have EXIF.
  • Loading branch information
oPromessa authored and RhetTbull committed Jan 17, 2023
1 parent f6fb4ad commit 9234d07
Showing 1 changed file with 4 additions and 0 deletions.
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

0 comments on commit 9234d07

Please sign in to comment.