diff --git a/copyparty/__main__.py b/copyparty/__main__.py index b3904031..6e2921bb 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -1802,7 +1802,7 @@ def add_thumbnail(ap): ap2.add_argument("--th-ff-jpg", action="store_true", help="force jpg output for video thumbs (avoids issues on some FFmpeg builds)") ap2.add_argument("--th-ff-swr", action="store_true", help="use swresample instead of soxr for audio thumbs (faster, lower accuracy, avoids issues on some FFmpeg builds)") ap2.add_argument("--th-vips-jxl", metavar="N", type=int, default=1, help="when to allow generating jxl thumbnails with libvips; 0=never, 1=musl-mallocng, 2=always") - ap2.add_argument("--th-poke", metavar="SEC", type=int, default=300, help="activity labeling cooldown -- avoids doing keepalive pokes (updating the mtime) on thumbnail folders more often than \033[33mSEC\033[0m seconds") + ap2.add_argument("--th-poke", metavar="SEC", type=int, default=300, help="activity labeling cooldown -- avoids doing keepalive pokes (updating the mtime) on thumbnail folders more often than \033[33mSEC\033[0m seconds; 0=no-keepalive") ap2.add_argument("--th-clean", metavar="SEC", type=int, default=43200, help="cleanup interval; 0=disabled") ap2.add_argument("--th-maxage", metavar="SEC", type=int, default=604800, help="max folder age -- folders which haven't been poked for longer than \033[33m--th-poke\033[0m seconds will get deleted every \033[33m--th-clean\033[0m seconds") ap2.add_argument("--th-pregen", metavar="F,F", type=u, default="", help="pregenerate thumbnails on startup; \033[33mF,F\033[0m is comma-separated list of formats; example: [\033[32mj,jf,w,w3,wf,wf3,x,xf\033[0m] NOTE: remember to set \033[33m--th-maxage 123456789\033[0m (volflag=th_pregen)") diff --git a/copyparty/svchub.py b/copyparty/svchub.py index 66bff686..d63b6308 100644 --- a/copyparty/svchub.py +++ b/copyparty/svchub.py @@ -476,6 +476,8 @@ class SvcHub(object): } args.th_poke = min(args.th_poke, args.th_maxage, args.ac_maxage) + if not args.th_clean: + args.th_poke = 0 zms = "" if not args.https_only: diff --git a/copyparty/th_cli.py b/copyparty/th_cli.py index 3cb0e3b5..5aedd8f4 100644 --- a/copyparty/th_cli.py +++ b/copyparty/th_cli.py @@ -31,7 +31,7 @@ class ThumbCli(object): self.asrv = hsrv.asrv # cache on both sides for less broker spam - self.cooldown = Cooldown(self.args.th_poke) + self.cooldown = Cooldown(self.args.th_poke) if self.args.th_poke else None self.thumbable = c["thumbable"] self.fmt_pil = c["pil"] @@ -149,14 +149,15 @@ class ThumbCli(object): pass if ret: - tdir = os.path.dirname(tpath) - if self.cooldown.poke(tdir): - self.broker.say("thumbsrv.poke", tdir) + if self.cooldown: + tdir = os.path.dirname(tpath) + if self.cooldown.poke(tdir): + self.broker.say("thumbsrv.poke", tdir) - if want_opus: - # audio files expire individually - if self.cooldown.poke(tpath): - self.broker.say("thumbsrv.poke", tpath) + if want_opus: + # audio files expire individually + if self.cooldown.poke(tpath): + self.broker.say("thumbsrv.poke", tpath) return ret diff --git a/copyparty/th_srv.py b/copyparty/th_srv.py index 9a1376a7..ada1c860 100644 --- a/copyparty/th_srv.py +++ b/copyparty/th_srv.py @@ -273,7 +273,7 @@ class ThumbSrv(object): self.log = self._log self.nextlog = 0 - self.poke_cd = Cooldown(self.args.th_poke) + self.poke_cd = Cooldown(self.args.th_poke) if self.args.th_poke else None self.mutex = threading.Lock() self.busy: dict[str, list[threading.Condition]] = {} @@ -1419,7 +1419,7 @@ class ThumbSrv(object): return ret def poke(self, tdir: str) -> None: - if not self.poke_cd.poke(tdir): + if not self.poke_cd or not self.poke_cd.poke(tdir): return ts = int(time.time())