From c06126cc9ddb761eb501c787a75ee738c71ee19f Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 19 Apr 2024 23:54:23 +0000 Subject: [PATCH] pipe: add volflag to disable --- copyparty/__main__.py | 1 + copyparty/cfg.py | 1 + copyparty/httpcli.py | 14 ++++++++------ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 4e72447b..36f3e7c3 100755 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -1091,6 +1091,7 @@ def add_optouts(ap): ap2.add_argument("--no-zip", action="store_true", help="disable download as zip/tar") ap2.add_argument("--no-tarcmp", action="store_true", help="disable download as compressed tar (?tar=gz, ?tar=bz2, ?tar=xz, ?tar=gz:9, ...)") ap2.add_argument("--no-lifetime", action="store_true", help="do not allow clients (or server config) to schedule an upload to be deleted after a given time") + ap2.add_argument("--no-pipe", action="store_true", help="disable race-the-beam (lockstep download of files which are currently being uploaded) (volflag=nopipe)") ap2.add_argument("--no-db-ip", action="store_true", help="do not write uploader IPs into the database") diff --git a/copyparty/cfg.py b/copyparty/cfg.py index a878b8df..b2cffcb5 100644 --- a/copyparty/cfg.py +++ b/copyparty/cfg.py @@ -16,6 +16,7 @@ def vf_bmap() -> dict[str, str]: "no_dedup": "copydupes", "no_dupe": "nodupe", "no_forget": "noforget", + "no_pipe": "nopipe", "no_robots": "norobots", "no_thumb": "dthumb", "no_vthumb": "dvthumb", diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 937c43ee..b3616b05 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -2936,12 +2936,12 @@ class HttpCli(object): logtail = "" if ptop is not None: - dp, fn = os.path.split(req_path) - tnam = fn + ".PARTIAL" - if self.args.dotpart: - tnam = "." + tnam - ap_data = os.path.join(dp, tnam) try: + dp, fn = os.path.split(req_path) + tnam = fn + ".PARTIAL" + if self.args.dotpart: + tnam = "." + tnam + ap_data = os.path.join(dp, tnam) st_data = bos.stat(ap_data) if not st_data.st_size: raise Exception("partial is empty") @@ -4179,7 +4179,9 @@ class HttpCli(object): ): return self.tx_md(vn, abspath) - return self.tx_file(abspath, None if st.st_size else vn.realpath) + return self.tx_file( + abspath, None if st.st_size or "nopipe" in vn.flags else vn.realpath + ) elif is_dir and not self.can_read: if self._use_dirkey(abspath):