mirror of
https://github.com/9001/copyparty.git
synced 2025-08-16 16:42:13 -06:00
don't print indexing progress to stdout if -q
This commit is contained in:
parent
b4e0a34193
commit
6dbfcddcda
|
@ -1601,7 +1601,7 @@ interact with copyparty using non-browser clients
|
|||
|
||||
* sharex (screenshot utility): see [./contrib/sharex.sxcu](contrib/#sharexsxcu)
|
||||
|
||||
* contextlet (web browser integration); see [contrib contextlet](contrib/readme.md#send-to-cppcontextletjson)
|
||||
* contextlet (web browser integration); see [contrib contextlet](contrib/#send-to-cppcontextletjson)
|
||||
|
||||
* [igloo irc](https://iglooirc.com/): Method: `post` Host: `https://you.com/up/?want=url&pw=hunter2` Multipart: `yes` File parameter: `f`
|
||||
|
||||
|
|
|
@ -583,7 +583,7 @@ class Up2k(object):
|
|||
if gid:
|
||||
self.log("reload #{} running".format(self.gid))
|
||||
|
||||
self.pp = ProgressPrinter()
|
||||
self.pp = ProgressPrinter(self.log, self.args)
|
||||
vols = list(all_vols.values())
|
||||
t0 = time.time()
|
||||
have_e2d = False
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# coding: utf-8
|
||||
from __future__ import print_function, unicode_literals
|
||||
|
||||
import argparse
|
||||
import base64
|
||||
import contextlib
|
||||
import errno
|
||||
|
@ -788,16 +789,20 @@ class ProgressPrinter(threading.Thread):
|
|||
periodically print progress info without linefeeds
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
def __init__(self, log: "NamedLogger", args: argparse.Namespace) -> None:
|
||||
threading.Thread.__init__(self, name="pp")
|
||||
self.daemon = True
|
||||
self.log = log
|
||||
self.args = args
|
||||
self.msg = ""
|
||||
self.end = False
|
||||
self.n = -1
|
||||
self.start()
|
||||
|
||||
def run(self) -> None:
|
||||
tp = 0
|
||||
msg = None
|
||||
no_stdout = self.args.q
|
||||
fmt = " {}\033[K\r" if VT100 else " {} $\r"
|
||||
while not self.end:
|
||||
time.sleep(0.1)
|
||||
|
@ -805,10 +810,21 @@ class ProgressPrinter(threading.Thread):
|
|||
continue
|
||||
|
||||
msg = self.msg
|
||||
now = time.time()
|
||||
if msg and now - tp > 10:
|
||||
tp = now
|
||||
self.log("progress: %s" % (msg,), 6)
|
||||
|
||||
if no_stdout:
|
||||
continue
|
||||
|
||||
uprint(fmt.format(msg))
|
||||
if PY2:
|
||||
sys.stdout.flush()
|
||||
|
||||
if no_stdout:
|
||||
return
|
||||
|
||||
if VT100:
|
||||
print("\033[K", end="")
|
||||
elif msg:
|
||||
|
|
Loading…
Reference in a new issue