diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 99c2b9d1..1605d55b 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -1578,6 +1578,9 @@ def add_logging(ap): ap2.add_argument("--ihead", metavar="HEADER", type=u, action='append', help="print request \033[33mHEADER\033[0m; [\033[32m*\033[0m]=all") ap2.add_argument("--ohead", metavar="HEADER", type=u, action='append', help="print response \033[33mHEADER\033[0m; [\033[32m*\033[0m]=all") ap2.add_argument("--lf-url", metavar="RE", type=u, default=r"^/\.cpr/|[?&]th=[wjp]|/\.(_|ql_|DS_Store$|localized$)", help="dont log URLs matching regex \033[33mRE\033[0m") + ap2.add_argument("--scan-st-r", metavar="SEC", type=float, default=0.1, help="fs-indexing: wait \033[33mSEC\033[0m between each status-message") + ap2.add_argument("--scan-pr-r", metavar="SEC", type=float, default=10, help="fs-indexing: wait \033[33mSEC\033[0m between each 'progress:' message") + ap2.add_argument("--scan-pr-s", metavar="MiB", type=float, default=1, help="fs-indexing: say 'file: ' when a file larger than \033[33mMiB\033[0m is about to be hashed") def add_admin(ap): diff --git a/copyparty/up2k.py b/copyparty/up2k.py index f6536e30..4b999ba2 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -1499,6 +1499,7 @@ class Up2k(object): th_cvd = self.args.th_coversd th_cvds = self.args.th_coversd_set + scan_pr_s = self.args.scan_pr_s assert self.pp and self.mem_cur # !rm self.pp.msg = "a%d %s" % (self.pp.n, cdir) @@ -1711,7 +1712,7 @@ class Up2k(object): if nohash or not sz: wark = up2k_wark_from_metadata(self.salt, sz, lmod, rd, fn) else: - if sz > 1024 * 1024: + if sz > 1024 * 1024 * scan_pr_s: self.log("file: %r" % (abspath,)) try: diff --git a/copyparty/util.py b/copyparty/util.py index 271c5e93..476105e8 100644 --- a/copyparty/util.py +++ b/copyparty/util.py @@ -1121,16 +1121,18 @@ class ProgressPrinter(threading.Thread): sigblock() tp = 0 msg = None - no_stdout = self.args.q + slp_pr = self.args.scan_pr_r + slp_ps = min(slp_pr, self.args.scan_st_r) + no_stdout = self.args.q or slp_pr == slp_ps fmt = " {}\033[K\r" if VT100 else " {} $\r" while not self.end: - time.sleep(0.1) + time.sleep(slp_ps) if msg == self.msg or self.end: continue msg = self.msg now = time.time() - if msg and now - tp > 10: + if msg and now - tp >= slp_pr: tp = now self.log("progress: %r" % (msg,), 6) diff --git a/tests/util.py b/tests/util.py index 8c9831c8..ddbd6631 100644 --- a/tests/util.py +++ b/tests/util.py @@ -155,7 +155,7 @@ class Cfg(Namespace): ex = "gid uid" ka.update(**{k: -1 for k in ex.split()}) - ex = "hash_mt hsortn qdel safe_dedup srch_time tail_fd tail_rate th_spec_p u2abort u2j u2sz unp_who" + ex = "hash_mt hsortn qdel safe_dedup scan_pr_r scan_pr_s scan_st_r srch_time tail_fd tail_rate th_spec_p u2abort u2j u2sz unp_who" ka.update(**{k: 1 for k in ex.split()}) ex = "ac_convt au_vol dl_list du_iwho mtab_age reg_cap s_thead s_tbody tail_tmax tail_who th_convt ups_who ver_iwho zip_who"