diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 4d0f6702..5ca64247 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -1295,7 +1295,7 @@ class HttpCli(object): tags[k] = v if icur: - taglist = [k for k in self.args.mte.split(",") if k in taglist] + taglist = [k for k in vn.flags["mte"].split(",") if k in taglist] for f in dirs: f["tags"] = {} @@ -1368,7 +1368,7 @@ class HttpCli(object): ts=ts, perms=json.dumps(perms), taglist=taglist, - tag_order=json.dumps(self.args.mte.split(",")), + tag_order=json.dumps(vn.flags["mte"].split(",")), have_up2k_idx=("e2d" in vn.flags), have_tags_idx=("e2t" in vn.flags), logues=logues, diff --git a/copyparty/mtag.py b/copyparty/mtag.py index 5fa1b79a..2b112be8 100644 --- a/copyparty/mtag.py +++ b/copyparty/mtag.py @@ -324,11 +324,15 @@ class MTag(object): for tagname, (binpath, timeout) in parsers.items(): try: cmd = [sys.executable, binpath, abspath] - if not WINDOWS: + args = {"env": env, "timeout": timeout} + + if WINDOWS: + args["creationflags"] = 0x4000 + else: cmd = ["nice"] + cmd cmd = [fsenc(x) for x in cmd] - v = sp.check_output(cmd, env=env, timeout=timeout).strip() + v = sp.check_output(cmd, **args).strip() if v: ret[tagname] = v.decode("utf-8") except: diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 567c06da..652054b7 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -13,6 +13,7 @@ import base64 import hashlib import threading import traceback +import subprocess as sp from copy import deepcopy from .__init__ import WINDOWS @@ -223,8 +224,9 @@ class Up2k(object): _, flags = self._expr_idx_filter(flags) - a = ["\033[36m{}:\033[0m{}".format(k, v) for k, v in sorted(flags.items())] - self.log(" ".join(a)) + a = "\033[0;36m{}:\033[1;30m{}" + a = [a.format(k, v) for k, v in sorted(flags.items())] + self.log(" ".join(a) + "\033[0m") reg = {} path = os.path.join(ptop, ".hist", "up2k.snap") @@ -622,6 +624,12 @@ class Up2k(object): self.log("mtp finished") def _start_mpool(self): + if WINDOWS and False: + nah = open(os.devnull, "wb") + wmic = f"processid={os.getpid()}" + wmic = ["wmic", "process", "where", wmic, "call", "setpriority"] + sp.call(wmic + ["below normal"], stdout=nah, stderr=nah) + # mp.pool.ThreadPool and concurrent.futures.ThreadPoolExecutor # both do crazy runahead so lets reinvent another wheel nw = os.cpu_count() if hasattr(os, "cpu_count") else 4 @@ -646,6 +654,11 @@ class Up2k(object): mpool.join() self._flush_mpool(wcur) + if WINDOWS and False: + nah = open(os.devnull, "wb") + wmic = f"processid={os.getpid()}" + wmic = ["wmic", "process", "where", wmic, "call", "setpriority"] + sp.call(wmic + ["below normal"], stdout=nah, stderr=nah) def _tag_thr(self, q): while True: