Skip to content

Commit 82e15fe

Browse files
Dalen WardTheLastGimbus
andauthored
Cleaner geoData fetch.
Co-authored-by: Mateusz Soszyński <[email protected]>
1 parent e672fe3 commit 82e15fe

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

google_photos_takeout_helper/__main__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,14 @@ def set_file_geo_data(file, json):
297297

298298
# fallbacks to GeoData Exif if it wasn't set in the photos editor.
299299
# https://github.com/TheLastGimbus/GooglePhotosTakeoutHelper/pull/5#discussion_r531792314
300-
if longitude == 0:
300+
longitude = float(json['geoData']['longitude'])
301+
latitude = float(json['geoData']['latitude'])
302+
altitude = json['geoData']['altitude']
303+
# Prioritise geoData set from GPhotos editor
304+
if longitude == 0 and latitude == 0:
301305
longitude = float(json['geoDataExif']['longitude'])
302-
if latitude == 0:
303306
latitude = float(json['geoDataExif']['latitude'])
304-
if altitude == 0:
305-
altitude = float(json['geoDataExif']['altitude'])
307+
altitude = json['geoDataExif']['altitude']
306308

307309
# latitude >= 0: North latitude -> "N"
308310
# latitude < 0: South latitude -> "S"

0 commit comments

Comments
 (0)