-
Notifications
You must be signed in to change notification settings - Fork 3
/
common.py
34 lines (29 loc) · 1.15 KB
/
common.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
camera_info = {
"fuji": {
"make": "FUJIFILM",
"model": "GFX100II",
"camera": "Fujifilm GFX 100 II",
},
"sony": {"make": "SONY", "model": "ILCE-7CM2", "camera": "SONY ILCE-7CM2"},
}
def archive_originals(dir, extension):
archive_dir = dir + "/archived/"
if not os.path.exists(archive_dir):
os.makedirs(archive_dir)
for filename in os.listdir(dir):
if filename.endswith(f".{extension}_original"):
original_path = os.path.join(dir, filename)
archive_file = filename.replace(f".{extension}_original", f".{extension}")
archive_path = os.path.join(archive_dir, archive_file)
os.rename(original_path, archive_path)
print(f"Renamed: {original_path} -> {archive_path}")
def convert(dir, camera_preset, extension):
make = camera_info[camera_preset]["make"]
model = camera_info[camera_preset]["model"]
camera = camera_info[camera_preset]["camera"]
command = f'exiftool -make="{make}" -model="{model}" -uniquecameramodel="{camera}" '
command += dir
print(command)
os.system(command)
archive_originals(dir, extension)