Skip to content

Commit

Permalink
On import consider GPS Location from XMP if EXIF is not available.
Browse files Browse the repository at this point in the history
On import consider GPS Location from XMP if EXIF is not available. Relevant for MOV file types without EXIF.
  • Loading branch information
oPromessa committed Jan 13, 2023
1 parent 8caee5a commit 5d0dc82
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 5d0dc82

Please sign in to comment.