aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2023-08-17 00:28:22 -0700
committerclarkzjw <[email protected]>2023-08-17 00:28:22 -0700
commitd1e1eeb51fd1bc8d902dd6248b6c1bd0ab7a9095 (patch)
tree41f81bc0ef4f8cb923e99e47d38857899cb38111
parentb4758633c7f2e535365855627bceae046f0e0558 (diff)
downloadSquare-d1e1eeb51fd1bc8d902dd6248b6c1bd0ab7a9095.tar.gz
fix paths
-rw-r--r--.gitignore2
-rw-r--r--exif.py18
-rwxr-xr-xsquare.py2
3 files changed, 11 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore
index 0a11640..ffc9762 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,7 @@
1.venv/
1.DS_Store 2.DS_Store
2__pycache__/ 3__pycache__/
3.env 4.env
4.idea/ 5.idea/
5*.png 6*.png
6*.jpg 7*.jpg
7
diff --git a/exif.py b/exif.py
index f526683..3e397ad 100644
--- a/exif.py
+++ b/exif.py
@@ -6,8 +6,8 @@ import exiftool
6 6
7 7
8def exif_rename(dir: str): 8def exif_rename(dir: str):
9 base_directory = pathlib.Path("C:\\Users\\clarkzjw\\Desktop") 9 base_directory = pathlib.Path("/pool1/clarkzjw/Media/Photo")
10 directory = str(base_directory.joinpath(dir).absolute()) + "\\" 10 directory = str(base_directory.joinpath(dir).absolute()) + "/"
11 11
12 files = os.listdir(directory) 12 files = os.listdir(directory)
13 for file in files: 13 for file in files:
@@ -21,16 +21,16 @@ def exif_rename(dir: str):
21 21
22 if (file.startswith("IMG_") and (file.endswith(".CR2") or file.endswith(".CR3"))) or \ 22 if (file.startswith("IMG_") and (file.endswith(".CR2") or file.endswith(".CR3"))) or \
23 (file.startswith("R") and (file.endswith(".JPG") or file.endswith(".DNG"))) or \ 23 (file.startswith("R") and (file.endswith(".JPG") or file.endswith(".DNG"))) or \
24 (file.startswith("PXL_") and file.endswith(".dng")) or \ 24 (file.startswith("PXL_") and (file.endswith(".jpg") or file.endswith(".dng"))) or \
25 (file.startswith("DSC") and file.endswith(".ARW")): 25 (file.startswith("DSC") and file.endswith(".ARW")):
26 with exiftool.ExifToolHelper() as et: 26 with exiftool.ExifToolHelper() as et:
27 for d in et.get_tags(filename, tags="EXIF:DateTimeOriginal"): 27 for d in et.get_tags(filename, tags="EXIF:DateTimeOriginal"):
28 timestamp = d["EXIF:DateTimeOriginal"].replace(":", "-") 28 if "EXIF:DateTimeOriginal" in d.keys():
29 break 29 timestamp = d["EXIF:DateTimeOriginal"].replace(":", "-")
30 30 filename = directory + timestamp + "-{}.{}".format(old_filename, ext)
31 filename = directory + timestamp + "-{}.{}".format(old_filename, ext) 31 print(filename)
32 print(filename) 32 os.rename(img, filename)
33 os.rename(img, filename) 33 break
34 34
35 35
36if __name__ == "__main__": 36if __name__ == "__main__":
diff --git a/square.py b/square.py
index 9e01138..e0fba89 100755
--- a/square.py
+++ b/square.py
@@ -67,7 +67,7 @@ def drop_shadow(image, offset=(5, 5), background=0xffffff, shadow=0x444444, bord
67if __name__ == "__main__": 67if __name__ == "__main__":
68 files = glob.glob("*") 68 files = glob.glob("*")
69 for file in files: 69 for file in files:
70 if (file.endswith(".jpg") or file.endswith(".png")) \ 70 if (file.endswith(".JPG") or file.endswith(".png")) \
71 and (str.find(file, "result") == -1): 71 and (str.find(file, "result") == -1):
72 72
73 names = file.split(".") 73 names = file.split(".")
Powered by cgit v1.2.3 (git 2.41.0)