|
@@ -45,9 +45,11 @@ def numpy_array_from_file(
|
|
return numpy.frombuffer(path.read_bytes(), dtype=dtype)
|
|
return numpy.frombuffer(path.read_bytes(), dtype=dtype)
|
|
|
|
|
|
|
|
|
|
-def read_exif_datetime_original(path: str) -> datetime.datetime:
|
|
|
|
|
|
+def read_exif_datetime_original(path: str) -> typing.Optional[datetime.datetime]:
|
|
with pathlib.Path(path).open("rb") as file:
|
|
with pathlib.Path(path).open("rb") as file:
|
|
tags = exifread.process_file(file)
|
|
tags = exifread.process_file(file)
|
|
|
|
+ if "EXIF DateTimeOriginal" not in tags:
|
|
|
|
+ return None
|
|
return dateutil.parser.parse(
|
|
return dateutil.parser.parse(
|
|
# https://web.archive.org/web/20240609164044/https://github.com/dateutil/dateutil/issues/271
|
|
# https://web.archive.org/web/20240609164044/https://github.com/dateutil/dateutil/issues/271
|
|
datetime.datetime.strptime(
|
|
datetime.datetime.strptime(
|