This commit is contained in:
parent
d8cee15f32
commit
b07d26c389
|
@ -11,6 +11,7 @@ are used to represent the actual files.
|
|||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import six
|
||||
|
||||
# load modules
|
||||
from elodie.external.pyexiftool import ExifTool
|
||||
|
@ -88,6 +89,11 @@ class Media(Base):
|
|||
for key in self.latitude_keys + self.longitude_keys:
|
||||
if key not in exif:
|
||||
continue
|
||||
if isinstance(exif[key], six.string_types) and len(exif[key]) == 0:
|
||||
# If exiftool GPS output is empty, the data returned will be a str
|
||||
# with 0 length.
|
||||
# https://github.com/jmathai/elodie/issues/354
|
||||
continue
|
||||
|
||||
# Cast coordinate to a float due to a bug in exiftool's
|
||||
# -json output format.
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
|
@ -113,6 +113,14 @@ def test_get_coordinates_with_zero_coordinate():
|
|||
assert helper.isclose(latitude,51.55325), latitude
|
||||
assert helper.isclose(longitude,-0.00417777777778), longitude
|
||||
|
||||
def test_get_coordinates_with_null_coordinate():
|
||||
photo = Photo(helper.get_file('with-null-coordinates.jpg'))
|
||||
latitude = photo.get_coordinate('latitude')
|
||||
longitude = photo.get_coordinate('longitude')
|
||||
|
||||
assert latitude is None, latitude
|
||||
assert longitude is None, longitude
|
||||
|
||||
def test_get_date_taken():
|
||||
photo = Photo(helper.get_file('plain.jpg'))
|
||||
date_taken = photo.get_date_taken()
|
||||
|
|
Loading…
Reference in New Issue