diff --git a/copyparty/authsrv.py b/copyparty/authsrv.py index a332e3f9..a863cf67 100644 --- a/copyparty/authsrv.py +++ b/copyparty/authsrv.py @@ -12,7 +12,7 @@ import threading import time from datetime import datetime -from .__init__ import ANYWIN, E, TYPE_CHECKING, WINDOWS +from .__init__ import ANYWIN, TYPE_CHECKING, WINDOWS, E from .bos import bos from .cfg import flagdescs, permdescs, vf_bmap, vf_cmap, vf_vmap from .pwhash import PWHash diff --git a/copyparty/httpsrv.py b/copyparty/httpsrv.py index dbfa17a8..286e9461 100644 --- a/copyparty/httpsrv.py +++ b/copyparty/httpsrv.py @@ -170,7 +170,7 @@ class HttpSrv(object): if self.args.log_thrs: start_log_thrs(self.log, self.args.log_thrs, nid) - self.th_cfg: dict[str, Any] = {} + self.th_cfg: dict[str, set[str]] = {} Daemon(self.post_init, "hsrv-init2") def post_init(self) -> None: diff --git a/copyparty/smbd.py b/copyparty/smbd.py index c4a3b8ed..fb1192ad 100644 --- a/copyparty/smbd.py +++ b/copyparty/smbd.py @@ -162,6 +162,7 @@ class SMB(object): if "connData" in cl: return cl["connData"]["partygoer"] cf = cf.f_back + raise Exception() except: warning( "nyoron... %s <<-- %s <<-- %s <<-- %s", diff --git a/copyparty/th_cli.py b/copyparty/th_cli.py index e0b7b144..296527f4 100644 --- a/copyparty/th_cli.py +++ b/copyparty/th_cli.py @@ -31,7 +31,7 @@ class ThumbCli(object): if not c: raise Exception() except: - c = {k: {} for k in ["thumbable", "pil", "vips", "ffi", "ffv", "ffa"]} + c = {k: set() for k in ["thumbable", "pil", "vips", "ffi", "ffv", "ffa"]} self.thumbable = c["thumbable"] self.fmt_pil = c["pil"] @@ -94,7 +94,7 @@ class ThumbCli(object): self.log("no histpath for [{}]".format(ptop)) return None - tpath = thumb_path(histpath, rem, mtime, fmt) + tpath = thumb_path(histpath, rem, mtime, fmt, self.fmt_ffa) tpaths = [tpath] if fmt == "w": # also check for jpg (maybe webp is unavailable) diff --git a/copyparty/th_srv.py b/copyparty/th_srv.py index 13f7338d..230fb2be 100644 --- a/copyparty/th_srv.py +++ b/copyparty/th_srv.py @@ -79,7 +79,7 @@ except: HAVE_VIPS = False -def thumb_path(histpath: str, rem: str, mtime: float, fmt: str) -> str: +def thumb_path(histpath: str, rem: str, mtime: float, fmt: str, ffa: set[str]) -> str: # base16 = 16 = 256 # b64-lc = 38 = 1444 # base64 = 64 = 4096 @@ -87,6 +87,11 @@ def thumb_path(histpath: str, rem: str, mtime: float, fmt: str) -> str: if not rd: rd = "\ntop" + # spectrograms are never cropped; strip fullsize flag + ext = rem.split(".")[-1].lower() + if ext in ffa and fmt in ("wf", "jf"): + fmt = fmt[:1] + rd += "\n" + fmt h = hashlib.sha512(afsenc(rd)).digest() b64 = base64.urlsafe_b64encode(h).decode("ascii")[:24] @@ -195,7 +200,7 @@ class ThumbSrv(object): self.log("no histpath for [{}]".format(ptop)) return None - tpath = thumb_path(histpath, rem, mtime, fmt) + tpath = thumb_path(histpath, rem, mtime, fmt, self.fmt_ffa) abspath = os.path.join(ptop, rem) cond = threading.Condition(self.mutex) do_conv = False