From cf60a91ab32ad3f4067b38552f1a112ccc180d61 Mon Sep 17 00:00:00 2001 From: Kamte <43906188+ckamte@users.noreply.github.com> Date: Thu, 21 Mar 2024 20:36:46 +0630 Subject: [PATCH] Skip existing is now working --- ccdl-win.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/ccdl-win.py b/ccdl-win.py index f320dbb..289f850 100644 --- a/ccdl-win.py +++ b/ccdl-win.py @@ -464,14 +464,6 @@ def download_progress(url, dest_dir, prefix=""): response = session.head(url, stream=False, headers=ADOBE_DL_HEADERS) total_size_in_bytes = int(response.headers.get("content-length", 0)) - if ( - args.skipExisting - and os.path.isfile(dest_dir) - and os.path.getsize(dest_dir) == total_size_in_bytes - ): - print("Downloaded file is OK, skipping ... \n") - return True - # download file response = session.get(url, stream=True, headers=ADOBE_REQ_HEADERS) @@ -480,6 +472,15 @@ def download_progress(url, dest_dir, prefix=""): filename = prefix + filename dest_dir = os.path.join(dest_dir, filename) + + if ( + args.skipExisting + and os.path.isfile(dest_dir) + and os.path.getsize(dest_dir) == total_size_in_bytes + ): + print("Downloaded file is OK, skipping ... \n") + return True + block_size = 1024 # 1 Kibibyte progress_bar = tqdm(total=total_size_in_bytes, unit="iB", unit_scale=True) with open(dest_dir, "wb") as file: @@ -807,7 +808,7 @@ def package_filter(package, language, platform): noneCoreCount += 1 print( - "Selected {} core packages and {} non-core packages".format( + "\nSelected {} core packages and {} non-core packages".format( coreCount, noneCoreCount ) ) @@ -882,8 +883,11 @@ def package_download(json, pkg_dir, language, selectedPlatform): # filtered json data json["Packages"]["Package"] = package - print("\nCreating Application.json") + print("\nCreating Application.json\n") + save_application_json(pkg_dir, json) + + # download packages for url in urls: if file_download(cdn + url, pkg_dir, sapCode, version) is False: return False @@ -941,6 +945,7 @@ def run_ccdl(products, cdn, sapCodes, selectedPlatform): if installLanguage.lower() != "all": app_json = language_filter(app_json, installLanguage) + print("\nDownloading main app package") if ( package_download(app_json, package_dir, installLanguage, selectedPlatform) is False @@ -948,7 +953,7 @@ def run_ccdl(products, cdn, sapCodes, selectedPlatform): print("\nCannot download all packages") if "Dependencies" in app_json: - print("\nDownloading dependencies") + print("\nDownloading dependency packages") dependencies_download( app_json, products, products_dir, installLanguage, selectedPlatform )