From 5ded5a451634a45519e129c51f57f20dad872daa Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 8 Jun 2021 21:42:08 +0200 Subject: [PATCH] alphabetical up2k indexing --- copyparty/up2k.py | 3 ++- copyparty/util.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 21510441..2b2e4763 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -381,7 +381,8 @@ class Up2k(object): self.pp.msg = "a{} {}".format(self.pp.n, cdir) histdir = os.path.join(top, ".hist") ret = 0 - for iname, inf in statdir(self.log, not self.args.no_scandir, False, cdir): + g = statdir(self.log, not self.args.no_scandir, False, cdir) + for iname, inf in sorted(g): abspath = os.path.join(cdir, iname) lmod = int(inf.st_mtime) if stat.S_ISDIR(inf.st_mode): diff --git a/copyparty/util.py b/copyparty/util.py index 1e58f273..2ab3020c 100644 --- a/copyparty/util.py +++ b/copyparty/util.py @@ -208,6 +208,8 @@ class ProgressPrinter(threading.Thread): msg = self.msg uprint(" {}\033[K\r".format(msg)) + if PY2: + sys.stdout.flush() print("\033[K", end="") sys.stdout.flush() # necessary on win10 even w/ stderr btw