Fix return value check for os.command
This commit is contained in:
parent
38bcf94123
commit
f70b347bd6
1 changed files with 3 additions and 4 deletions
|
@ -5,7 +5,7 @@ import tempfile
|
||||||
import shutil
|
import shutil
|
||||||
import os
|
import os
|
||||||
import helper
|
import helper
|
||||||
import darktable
|
from darktable 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(
|
||||||
|
@ -42,16 +42,15 @@ 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 + '"'
|
||||||
if os.system(cmd):
|
if os.system(cmd) == 0:
|
||||||
# Get .xmp file if available
|
# Get .xmp file if available
|
||||||
cmd = 'scp "' + remotehost + ':' + escaped_remotefile + '.xmp" "' + localfile + '.xmp"'
|
cmd = 'scp "' + remotehost + ':' + escaped_remotefile + '.xmp" "' + localfile + '.xmp"'
|
||||||
if os.system(cmd):
|
if os.system(cmd) == 0:
|
||||||
# Use darktable
|
# Use darktable
|
||||||
d = Darktable(localfile)
|
d = Darktable(localfile)
|
||||||
d.export()
|
d.export()
|
||||||
os.remove(localfile)
|
os.remove(localfile)
|
||||||
os.remove(localfile + ".xmp")
|
os.remove(localfile + ".xmp")
|
||||||
|
|
||||||
return dirpath
|
return dirpath
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue