This commit is contained in:
2026-06-19 05:31:31 +02:00
parent 92048d51f7
commit d398408458
2 changed files with 17 additions and 3 deletions
+15 -2
View File
@@ -210,6 +210,15 @@ def main():
dest = Path(args.dest)
dest.mkdir(parents=True, exist_ok=True)
log_path = dest / "_export_log.txt"
# preflight: dosahnu na filer?
try:
requests.get(args.filer, timeout=8)
print(f"Filer OK: {args.filer}\n", flush=True)
except Exception as e:
sys.exit(f"NEDOSTUPNY FILER {args.filer} :: {e}\n"
f"Zkontroluj sit / VPN na 192.168.1.50:8888 z tohoto stroje.")
done = skipped = failed = 0
dl_bytes = 0
t0 = time.time()
@@ -221,9 +230,12 @@ def main():
if dst.exists() and dst.stat().st_size == size:
skipped += 1
continue
print(f"[{n}/{len(plan)}] ↓ {size/1024**2:.1f}MB {fn}", flush=True)
try:
url = filer_url(args.filer, path)
with requests.get(url, stream=True, timeout=300) as r:
ts = time.time()
# timeout=(connect, read) -> zaseknute spojeni spadne rychle
with requests.get(url, stream=True, timeout=(15, 90)) as r:
r.raise_for_status()
tmp = dst.with_suffix(".part")
with open(tmp, "wb") as f:
@@ -232,7 +244,8 @@ def main():
tmp.replace(dst)
done += 1
dl_bytes += size
msg = f"[{n}/{len(plan)}] OK {size/1024**2:.1f}MB {fn}"
sp = size / 1024**2 / max(time.time() - ts, 0.1)
msg = f"[{n}/{len(plan)}] OK {size/1024**2:.1f}MB ({sp:.1f} MB/s) {fn}"
except Exception as e:
failed += 1
msg = f"[{n}/{len(plan)}] FAIL {fn} :: {e}"