Add Darktable to export files

This commit is contained in:
Jeena 2021-09-08 12:08:48 +09:00
parent 7e0fea113b
commit 38bcf94123
2 changed files with 37 additions and 1 deletions

26
darktable.py Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env python3
from os import access, R_OK
from os.path import isfile
from helper import escape_file_path as ef
import sys, os
class Darktable:
def __init__(self, path):
self.original_path = path
def export(self):
escaped_file_path = self.original_path
filename, file_extension = os.path.splitext(self.original_path)
new_path = filename + ".jpeg"
cmd = "darktable-cli " + ef(self.original_path) + " " + ef(new_path)
os.system(cmd)
return new_path
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: darktable.py path/to/picture.NEF")
else:
img_path = sys.argv[1]
d = Darktable(img_path)
print(d.export())