Skip to content

Commit

Permalink
push-exif --compare location consider QuickTime:GPSCoordinates for Mo…
Browse files Browse the repository at this point in the history
…vies (#1686)

* push-exif --compare location consider QuickTime:GPSCoordaintes for Movies. Aligned with push-exif location (when writing)

* QuickTime:GPSCoordinates may return lat, long and altitude. Discard altitude in this case.
  • Loading branch information
oPromessa authored Nov 5, 2024
1 parent cfc3a89 commit d5fc15a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions osxphotos/cli/push_exif.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,10 +635,16 @@ def compare_location(photo: PhotoInfo, file_data: dict[str, Any]) -> str:
"""Compare location between Photos and original file for a single photo"""
photo_latitude = photo.latitude
photo_longitude = photo.longitude
exif_latitude = file_data.get("EXIF:GPSLatitude")
exif_longitude = file_data.get("EXIF:GPSLongitude")
exif_latitude_ref = file_data.get("EXIF:GPSLatitudeRef")
exif_longitude_ref = file_data.get("EXIF:GPSLongitudeRef")
if photo.isphoto:
exif_latitude = file_data.get("EXIF:GPSLatitude")
exif_longitude = file_data.get("EXIF:GPSLongitude")
exif_latitude_ref = file_data.get("EXIF:GPSLatitudeRef")
exif_longitude_ref = file_data.get("EXIF:GPSLongitudeRef")
elif photo.ismovie:
exif_coordinates = file_data.get('QuickTime:GPSCoordinates')
exif_latitude, exif_longitude = [float(x) for x in exif_coordinates.split()[:2]] if exif_coordinates else [ None, None]
exif_latitude_ref = None
exif_longitude_ref = None

if exif_longitude and exif_longitude_ref == "W":
exif_longitude = -exif_longitude
Expand Down

0 comments on commit d5fc15a

Please sign in to comment.