From f70b347bd6e88b9fd37cd3ca3ac14e9b0c243931 Mon Sep 17 00:00:00 2001 From: Jeena Date: Wed, 8 Sep 2021 05:19:40 +0200 Subject: [PATCH] Fix return value check for os.command --- synology.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/synology.py b/synology.py index eb31a85..8cdda59 100755 --- a/synology.py +++ b/synology.py @@ -5,7 +5,7 @@ import tempfile import shutil import os import helper -import darktable +from darktable import Darktable def connect_db(db_host, db_user, db_passwd): return psycopg2.connect( @@ -42,16 +42,15 @@ 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 + '"' - if os.system(cmd): + if os.system(cmd) == 0: # Get .xmp file if available cmd = 'scp "' + remotehost + ':' + escaped_remotefile + '.xmp" "' + localfile + '.xmp"' - if os.system(cmd): + if os.system(cmd) == 0: # Use darktable d = Darktable(localfile) d.export() os.remove(localfile) os.remove(localfile + ".xmp") - return dirpath