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

View file

@ -5,6 +5,7 @@ import tempfile
import shutil
import os
import helper
import darktable
def connect_db(db_host, db_user, db_passwd):
return psycopg2.connect(
@ -41,7 +42,16 @@ def fetch_files(remotehost, lib_path, pictures):
localfile = '/'.join([dirpath, picture[1]])
escaped_remotefile = helper.escape_file_path(remotefile)
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