aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'exif.py')
-rw-r--r--exif.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/exif.py b/exif.py
index 3e397ad..79c0624 100644
--- a/exif.py
+++ b/exif.py
@@ -3,10 +3,12 @@ import pathlib
3import platform 3import platform
4import sys 4import sys
5import exiftool 5import exiftool
6from datetime import datetime, timedelta
6 7
8offset = 1
7 9
8def exif_rename(dir: str): 10def exif_rename(dir: str):
9 base_directory = pathlib.Path("/pool1/clarkzjw/Media/Photo") 11 base_directory = pathlib.Path("/mnt/pool1/Media/Photo")
10 directory = str(base_directory.joinpath(dir).absolute()) + "/" 12 directory = str(base_directory.joinpath(dir).absolute()) + "/"
11 13
12 files = os.listdir(directory) 14 files = os.listdir(directory)
@@ -26,7 +28,13 @@ def exif_rename(dir: str):
26 with exiftool.ExifToolHelper() as et: 28 with exiftool.ExifToolHelper() as et:
27 for d in et.get_tags(filename, tags="EXIF:DateTimeOriginal"): 29 for d in et.get_tags(filename, tags="EXIF:DateTimeOriginal"):
28 if "EXIF:DateTimeOriginal" in d.keys(): 30 if "EXIF:DateTimeOriginal" in d.keys():
29 timestamp = d["EXIF:DateTimeOriginal"].replace(":", "-") 31 #serial = int(filename.split("/")[-1].split(".")[0][1:])
32 datetime_object = datetime.strptime(d["EXIF:DateTimeOriginal"], '%Y:%m:%d %H:%M:%S')
33 #if serial > 8630:
34 # datetime_object += timedelta(hours=10)
35 #else:
36 # datetime_object += timedelta(hours=offset)
37 timestamp = str(datetime_object).replace(":", "-")
30 filename = directory + timestamp + "-{}.{}".format(old_filename, ext) 38 filename = directory + timestamp + "-{}.{}".format(old_filename, ext)
31 print(filename) 39 print(filename)
32 os.rename(img, filename) 40 os.rename(img, filename)
Powered by cgit v1.2.3 (git 2.41.0)