From ac1bc232a95af7ce95f2e535a51821674b47965b Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 31 May 2024 08:57:33 +0000 Subject: [PATCH] black --- copyparty/mtag.py | 4 +++- copyparty/sutil.py | 4 +++- copyparty/th_cli.py | 2 +- copyparty/th_srv.py | 11 ++++++----- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/copyparty/mtag.py b/copyparty/mtag.py index 72f5e3da..2a6d226c 100644 --- a/copyparty/mtag.py +++ b/copyparty/mtag.py @@ -111,7 +111,9 @@ class MParser(object): raise Exception() -def au_unpk(log: "NamedLogger", fmt_map: dict[str, str], abspath: str, vn: Optional[VFS] = None) -> str: +def au_unpk( + log: "NamedLogger", fmt_map: dict[str, str], abspath: str, vn: Optional[VFS] = None +) -> str: ret = "" try: ext = abspath.split(".")[-1].lower() diff --git a/copyparty/sutil.py b/copyparty/sutil.py index a01e2c66..6f804f07 100644 --- a/copyparty/sutil.py +++ b/copyparty/sutil.py @@ -104,7 +104,9 @@ def enthumb( return f -def errdesc(vfs: VFS, errors: list[tuple[str, str]]) -> tuple[dict[str, Any], list[str]]: +def errdesc( + vfs: VFS, errors: list[tuple[str, str]] +) -> tuple[dict[str, Any], list[str]]: report = ["copyparty failed to add the following files to the archive:", ""] for fn, err in errors: diff --git a/copyparty/th_cli.py b/copyparty/th_cli.py index 285d4a48..0c69be5f 100644 --- a/copyparty/th_cli.py +++ b/copyparty/th_cli.py @@ -106,7 +106,7 @@ class ThumbCli(object): sfmt += "3" if "3" in fmt else "" fmt = sfmt - + elif fmt[:1] == "p" and not is_au: t = "cannot thumbnail [%s]: png only allowed for waveforms" self.log(t % (rem), 6) diff --git a/copyparty/th_srv.py b/copyparty/th_srv.py index 3f49497d..88d03395 100644 --- a/copyparty/th_srv.py +++ b/copyparty/th_srv.py @@ -599,13 +599,14 @@ class ThumbSrv(object): b"pngquant", b"--strip", b"--nofs", - b"--output", fsenc(wtpath), - fsenc(tpath) + b"--output", + fsenc(wtpath), + fsenc(tpath), ] ret = runcmd(cmd, timeout=vn.flags["convt"], nice=True, oom=400)[0] if ret: try: - wunlink(self.log, wtpath, vn.flags) + wunlink(self.log, wtpath, vn.flags) except: pass else: @@ -803,8 +804,8 @@ class ThumbSrv(object): for k, vs in raw_tags.items(): for v in vs: if len(str(v)) >= 1024: - bv = (k + "=").encode("utf-8", "replace") - ret += [b"-metadata", bv] + bv = k.encode("utf-8", "replace") + ret += [b"-metadata", bv + b"="] break return ret