Add Darktable to export files
This commit is contained in:
parent
7e0fea113b
commit
38bcf94123
2 changed files with 37 additions and 1 deletions
26
darktable.py
Executable file
26
darktable.py
Executable 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())
|
12
synology.py
12
synology.py
|
@ -5,6 +5,7 @@ import tempfile
|
||||||
import shutil
|
import shutil
|
||||||
import os
|
import os
|
||||||
import helper
|
import helper
|
||||||
|
import darktable
|
||||||
|
|
||||||
def connect_db(db_host, db_user, db_passwd):
|
def connect_db(db_host, db_user, db_passwd):
|
||||||
return psycopg2.connect(
|
return psycopg2.connect(
|
||||||
|
@ -41,7 +42,16 @@ def fetch_files(remotehost, lib_path, pictures):
|
||||||
localfile = '/'.join([dirpath, picture[1]])
|
localfile = '/'.join([dirpath, picture[1]])
|
||||||
escaped_remotefile = helper.escape_file_path(remotefile)
|
escaped_remotefile = helper.escape_file_path(remotefile)
|
||||||
cmd = 'scp "' + remotehost + ':' + escaped_remotefile + '" "' + localfile + '"'
|
cmd = 'scp "' + remotehost + ':' + escaped_remotefile + '" "' + localfile + '"'
|
||||||
os.system(cmd)
|
if os.system(cmd):
|
||||||
|
# Get .xmp file if available
|
||||||
|
cmd = 'scp "' + remotehost + ':' + escaped_remotefile + '.xmp" "' + localfile + '.xmp"'
|
||||||
|
if os.system(cmd):
|
||||||
|
# Use darktable
|
||||||
|
d = Darktable(localfile)
|
||||||
|
d.export()
|
||||||
|
os.remove(localfile)
|
||||||
|
os.remove(localfile + ".xmp")
|
||||||
|
|
||||||
return dirpath
|
return dirpath
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue