From 56a26b0916115ccb01cadd22e81305e9b9cb6c4c Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 12 Feb 2021 17:10:08 +0100 Subject: [PATCH] up2k: print final commit too --- copyparty/__main__.py | 9 ++++----- copyparty/up2k.py | 8 ++++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 5a379c20..ab8e17c7 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -144,12 +144,11 @@ def configure_ssl_ciphers(al): is_help = al.ciphers == "help" - if al.ciphers: + if al.ciphers and not is_help: try: ctx.set_ciphers(al.ciphers) except: - if not is_help: - print("\n\033[1;31mfailed to set ciphers\033[0m\n") + print("\n\033[1;31mfailed to set ciphers\033[0m\n") if not hasattr(ctx, "get_ciphers"): print("cannot read cipher list: openssl or python too old") @@ -211,8 +210,8 @@ def main(): "print,get" prints the data in the log and returns GET (leave out the ",get" to return an error instead) - see "--ciphers help" for available ssl/tls ciphers, - see "--ssl-ver help" for available ssl/tls versions, + --ciphers help = available ssl/tls ciphers, + --ssl-ver help = available ssl/tls versions, default is what python considers safe, usually >= TLS1 """ ), diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 1cd3ff67..75706188 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -130,8 +130,12 @@ class Up2k(object): if db: # can be symlink so don't `and d.startswith(top)`` excl = set([d for d in tops if d != top]) - self._build_dir([db, 0, time.time()], top, excl, top) + dbw = [db, 0, time.time()] + self._build_dir(dbw, top, excl, top) self._drop_lost(db, top) + if dbw[1]: + self.log("up2k", "commit {} new files".format(dbw[1])) + db.commit() def _build_dir(self, dbw, top, excl, cdir): @@ -190,7 +194,7 @@ class Up2k(object): dbw[1] += 1 td = time.time() - dbw[2] if dbw[1] > 1024 or td > 60: - self.log("up2k", "commit {} files".format(dbw[1])) + self.log("up2k", "commit {} new files".format(dbw[1])) dbw[0].commit() dbw[1] = 0 dbw[2] = time.time()