From 633db08d98e69198a7911748ea9c975fa7a1783a Mon Sep 17 00:00:00 2001 From: Xie Yanbo Date: Fri, 24 Nov 2023 18:05:16 +0800 Subject: [PATCH] feat: do not re-download files if local size big enough (#91) --- task/baidupcs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/task/baidupcs.py b/task/baidupcs.py index 69a6776..ec28c8d 100644 --- a/task/baidupcs.py +++ b/task/baidupcs.py @@ -110,8 +110,8 @@ def download_file(self, remote_path, local_dir, file_size, sample_size=0): local_path.parent.mkdir(parents=True) if local_path.exists(): - if (sample_size and sample_size == getsize(local_path)) or ( - not sample_size and file_size == getsize(local_path) + if (sample_size and sample_size <= getsize(local_path)) or ( + not sample_size and file_size <= getsize(local_path) ): logger.info(f"{local_path} is ready existed.") return