|
@@ -1,3 +1,4 @@
|
|
|
|
+import datetime
|
|
import functools
|
|
import functools
|
|
import itertools
|
|
import itertools
|
|
import os
|
|
import os
|
|
@@ -5,6 +6,8 @@ import pathlib
|
|
import typing
|
|
import typing
|
|
import warnings
|
|
import warnings
|
|
|
|
|
|
|
|
+import dateutil.parser
|
|
|
|
+import exifread
|
|
import numpy
|
|
import numpy
|
|
import pandas
|
|
import pandas
|
|
import pgpdump
|
|
import pgpdump
|
|
@@ -42,6 +45,17 @@ 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:
|
|
|
|
+ with pathlib.Path(path).open("rb") as file:
|
|
|
|
+ tags = exifread.process_file(file)
|
|
|
|
+ return dateutil.parser.parse(
|
|
|
|
+ tags["EXIF DateTimeOriginal"].values
|
|
|
|
+ + "."
|
|
|
|
+ + tags["EXIF SubSecTimeOriginal"].values
|
|
|
|
+ + tags["EXIF OffsetTimeOriginal"].values
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+
|
|
def split_pgp_file(
|
|
def split_pgp_file(
|
|
path: pathlib.Path,
|
|
path: pathlib.Path,
|
|
) -> typing.Iterator[typing.Union[bytearray, pgpdump.packet.Packet]]:
|
|
) -> typing.Iterator[typing.Union[bytearray, pgpdump.packet.Packet]]:
|