mirror of
https://github.com/ckamte/adobe-packager-windows.git
synced 2026-11-19 20:17:20 -05:00
Check and skip before download process
This commit is contained in:
71
ccdl-win.py
71
ccdl-win.py
@@ -48,7 +48,8 @@ ADOBE_REQ_HEADERS = {
|
|||||||
"User-Agent": "Adobe Application Manager 2.0",
|
"User-Agent": "Adobe Application Manager 2.0",
|
||||||
"X-Api-Key": "CC_HD_ESD_1_0",
|
"X-Api-Key": "CC_HD_ESD_1_0",
|
||||||
"Cookie": "fg="
|
"Cookie": "fg="
|
||||||
+ "".join(random.choice(string.ascii_uppercase + string.digits) for _ in range(26))
|
+ "".join(random.choice(string.ascii_uppercase + string.digits)
|
||||||
|
for _ in range(26))
|
||||||
+ "======",
|
+ "======",
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +63,8 @@ def show_version():
|
|||||||
print("=================================")
|
print("=================================")
|
||||||
print("= Adobe CC Package Downloader =")
|
print("= Adobe CC Package Downloader =")
|
||||||
print(
|
print(
|
||||||
"{} {} {}\n".format("=" * ye, VERSION_STR, "=" * (31 - len(VERSION_STR) - ye))
|
"{} {} {}\n".format("=" * ye, VERSION_STR, "=" *
|
||||||
|
(31 - len(VERSION_STR) - ye))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -160,6 +162,7 @@ def app_platform():
|
|||||||
|
|
||||||
return appPlatform
|
return appPlatform
|
||||||
|
|
||||||
|
|
||||||
def select_product(products, sapCodes):
|
def select_product(products, sapCodes):
|
||||||
for s, d in sapCodes.items():
|
for s, d in sapCodes.items():
|
||||||
print("[{}]{}{}".format(s, (10 - len(s)) * " ", d))
|
print("[{}]{}{}".format(s, (10 - len(s)) * " ", d))
|
||||||
@@ -167,22 +170,24 @@ def select_product(products, sapCodes):
|
|||||||
slectedProduct = None
|
slectedProduct = None
|
||||||
|
|
||||||
while slectedProduct is None:
|
while slectedProduct is None:
|
||||||
val = input(
|
val = input(
|
||||||
"\nPlease enter the SAP Code of the desired product from the list above: "
|
"\nPlease enter the SAP Code of the desired product from the list above: "
|
||||||
).upper()
|
).upper()
|
||||||
if products.get(val):
|
if products.get(val):
|
||||||
slectedProduct = val
|
slectedProduct = val
|
||||||
elif val == "":
|
elif val == "":
|
||||||
print("No product selected! Please use a value from the list above.")
|
print("No product selected! Please use a value from the list above.")
|
||||||
else:
|
else:
|
||||||
print(
|
print(
|
||||||
"{} is not available! Please use a value from the list above.".format(
|
"{} is not available! Please use a value from the list above.".format(
|
||||||
val
|
val
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
)
|
||||||
return slectedProduct
|
return slectedProduct
|
||||||
|
|
||||||
# for batch download
|
# for batch download
|
||||||
|
|
||||||
|
|
||||||
def product_code(products, sapCodes):
|
def product_code(products, sapCodes):
|
||||||
codeList = []
|
codeList = []
|
||||||
toDown = args.sapCode
|
toDown = args.sapCode
|
||||||
@@ -202,7 +207,8 @@ def product_code(products, sapCodes):
|
|||||||
answer = select_product(products, sapCodes)
|
answer = select_product(products, sapCodes)
|
||||||
# for duplicate entry
|
# for duplicate entry
|
||||||
while answer in codeList:
|
while answer in codeList:
|
||||||
print("\nAdd {} already exist in donload list".format(answer))
|
print(
|
||||||
|
"\nAdd {} already exist in donload list".format(answer))
|
||||||
answer = input(
|
answer = input(
|
||||||
"\nPlease enter the SAP Code of the desired product from the list above: "
|
"\nPlease enter the SAP Code of the desired product from the list above: "
|
||||||
).upper()
|
).upper()
|
||||||
@@ -221,6 +227,7 @@ def product_code(products, sapCodes):
|
|||||||
|
|
||||||
return codeList
|
return codeList
|
||||||
|
|
||||||
|
|
||||||
def product_version(product, versions):
|
def product_version(product, versions):
|
||||||
version = None
|
version = None
|
||||||
if args.version:
|
if args.version:
|
||||||
@@ -357,13 +364,14 @@ def product_languages(elem):
|
|||||||
def parse_products_xml(products_url, url_version, allowed_platform, selected_platform):
|
def parse_products_xml(products_url, url_version, allowed_platform, selected_platform):
|
||||||
# get xml data
|
# get xml data
|
||||||
print("Downloading product data\n")
|
print("Downloading product data\n")
|
||||||
response = session.get(products_url, stream=True, headers=ADOBE_REQ_HEADERS)
|
response = session.get(products_url, stream=True,
|
||||||
|
headers=ADOBE_REQ_HEADERS)
|
||||||
response.encoding = "utf-8"
|
response.encoding = "utf-8"
|
||||||
products_xml = ET.fromstring(response.content)
|
products_xml = ET.fromstring(response.content)
|
||||||
|
|
||||||
#with open("ffc.xml", "wb+") as f:
|
# with open("ffc.xml", "wb+") as f:
|
||||||
# f.write(response.content)
|
# f.write(response.content)
|
||||||
#products_xml = ET.parse("ffc.xml")
|
# products_xml = ET.parse("ffc.xml")
|
||||||
|
|
||||||
cdn = products_xml.find(".//*/cdn/secure").text
|
cdn = products_xml.find(".//*/cdn/secure").text
|
||||||
allProducts = {}
|
allProducts = {}
|
||||||
@@ -422,7 +430,8 @@ def parse_products_xml(products_url, url_version, allowed_platform, selected_pla
|
|||||||
"manifestURL": manifestURL,
|
"manifestURL": manifestURL,
|
||||||
}
|
}
|
||||||
if args.productIcons:
|
if args.productIcons:
|
||||||
allProducts[sapCode]["versions"][productVersion]['productIcons'] = product_icons(product)
|
allProducts[sapCode]["versions"][productVersion]['productIcons'] = product_icons(
|
||||||
|
product)
|
||||||
else:
|
else:
|
||||||
if url_version >= 5:
|
if url_version >= 5:
|
||||||
allProducts.pop(sapCode, None)
|
allProducts.pop(sapCode, None)
|
||||||
@@ -484,9 +493,7 @@ def download_progress(url, dest_dir, prefix=""):
|
|||||||
response = session.head(url, stream=False, headers=ADOBE_DL_HEADERS)
|
response = session.head(url, stream=False, headers=ADOBE_DL_HEADERS)
|
||||||
total_size_in_bytes = int(response.headers.get("content-length", 0))
|
total_size_in_bytes = int(response.headers.get("content-length", 0))
|
||||||
|
|
||||||
# download file
|
# skip existing files
|
||||||
response = session.get(url, stream=True, headers=ADOBE_REQ_HEADERS)
|
|
||||||
|
|
||||||
filename = os.path.basename(url)
|
filename = os.path.basename(url)
|
||||||
if prefix:
|
if prefix:
|
||||||
filename = prefix + filename
|
filename = prefix + filename
|
||||||
@@ -501,6 +508,9 @@ def download_progress(url, dest_dir, prefix=""):
|
|||||||
print("Downloaded file is OK, skipping ... \n")
|
print("Downloaded file is OK, skipping ... \n")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
# download file
|
||||||
|
response = session.get(url, stream=True, headers=ADOBE_REQ_HEADERS)
|
||||||
|
|
||||||
block_size = 1024 # 1 Kibibyte
|
block_size = 1024 # 1 Kibibyte
|
||||||
progress_bar = tqdm(total=total_size_in_bytes, unit="iB", unit_scale=True)
|
progress_bar = tqdm(total=total_size_in_bytes, unit="iB", unit_scale=True)
|
||||||
with open(dest_dir, "wb") as file:
|
with open(dest_dir, "wb") as file:
|
||||||
@@ -745,18 +755,21 @@ def condition_filter(package, language, ProcessorFamily):
|
|||||||
if "&&" in conditionString:
|
if "&&" in conditionString:
|
||||||
conditions = conditionString.split("&&")
|
conditions = conditionString.split("&&")
|
||||||
for condition in conditions:
|
for condition in conditions:
|
||||||
testResult = condition_test(package, language, ProcessorFamily, condition)
|
testResult = condition_test(
|
||||||
|
package, language, ProcessorFamily, condition)
|
||||||
if testResult is False:
|
if testResult is False:
|
||||||
break
|
break
|
||||||
|
|
||||||
elif "||" in conditionString:
|
elif "||" in conditionString:
|
||||||
conditions = conditionString.split("||")
|
conditions = conditionString.split("||")
|
||||||
for condition in conditions:
|
for condition in conditions:
|
||||||
testResult = condition_test(package, language, ProcessorFamily, condition)
|
testResult = condition_test(
|
||||||
|
package, language, ProcessorFamily, condition)
|
||||||
if testResult is True:
|
if testResult is True:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
testResult = condition_test(package, language, ProcessorFamily, conditionString)
|
testResult = condition_test(
|
||||||
|
package, language, ProcessorFamily, conditionString)
|
||||||
|
|
||||||
return testResult
|
return testResult
|
||||||
|
|
||||||
@@ -869,7 +882,8 @@ def dependencies_download(json, products, pds_dir, installLanguage, selectedPlat
|
|||||||
firstItem = dep_data[0]
|
firstItem = dep_data[0]
|
||||||
dep_json = get_application_json(firstItem["buildGuid"])
|
dep_json = get_application_json(firstItem["buildGuid"])
|
||||||
if (
|
if (
|
||||||
package_download(dep_json, dep_dir, installLanguage, selectedPlatform)
|
package_download(dep_json, dep_dir,
|
||||||
|
installLanguage, selectedPlatform)
|
||||||
is False
|
is False
|
||||||
):
|
):
|
||||||
print("\nCannot download dependency package")
|
print("\nCannot download dependency package")
|
||||||
@@ -936,7 +950,7 @@ def run_ccdl(products, cdn, sapCodes, selectedPlatform):
|
|||||||
# download by manifest url
|
# download by manifest url
|
||||||
if sapCode == "APRO":
|
if sapCode == "APRO":
|
||||||
download_acrobat(prodInfo, cdn)
|
download_acrobat(prodInfo, cdn)
|
||||||
return
|
continue
|
||||||
|
|
||||||
# main product
|
# main product
|
||||||
print(
|
print(
|
||||||
@@ -970,7 +984,8 @@ def run_ccdl(products, cdn, sapCodes, selectedPlatform):
|
|||||||
|
|
||||||
print("\nDownloading main app package")
|
print("\nDownloading main app package")
|
||||||
if (
|
if (
|
||||||
package_download(app_json, package_dir, installLanguage, selectedPlatform)
|
package_download(app_json, package_dir,
|
||||||
|
installLanguage, selectedPlatform)
|
||||||
is False
|
is False
|
||||||
):
|
):
|
||||||
print("\nCannot download all packages")
|
print("\nCannot download all packages")
|
||||||
|
|||||||
Reference in New Issue
Block a user