Add batch download function

This commit is contained in:
ckamte
2025-11-25 13:18:18 +06:30
parent 4b26d8c02d
commit 451209f127
2 changed files with 123 additions and 92 deletions

View File

@@ -15,7 +15,7 @@ Arguments:
"-l", "--installLanguage", "Language code (eg. en_US)" "-l", "--installLanguage", "Language code (eg. en_US)"
"-o", "--osLanguage", "OS Language code (eg. en_US)" "-o", "--osLanguage", "OS Language code (eg. en_US)"
"-p", "--appPlatform", "Application platform (eg. win64)" "-p", "--appPlatform", "Application platform (eg. win64)"
"-s", "--sapCode", "SAP code for desired product (eg. PHSP)" "-s", "--sapCode", "SAP code for desired product (eg. PHSP). For batch download use comma to separate products"
"-v", "--version", "Version of desired product (eg. 21.0.3)" "-v", "--version", "Version of desired product (eg. 21.0.3)"
"-d", "--destination", "Directory to download installation files to" "-d", "--destination", "Directory to download installation files to"
"-u", "--urlVersion", "Get app info from v4/v5/v6 url (eg. v6)" "-u", "--urlVersion", "Get app info from v4/v5/v6 url (eg. v6)"
@@ -36,3 +36,11 @@ Arguments:
6. Optional - Delete downloaded zip files in "acc_sources" directory to reduce installer size (Not necessary because omitting the folder if the whole installation is packed is valid and if kept, used for other products) 6. Optional - Delete downloaded zip files in "acc_sources" directory to reduce installer size (Not necessary because omitting the folder if the whole installation is packed is valid and if kept, used for other products)
7. Run Set-up.exe to install the product. 7. Run Set-up.exe to install the product.
8. Note - Make sure AdobePIM.dll file version in "resources" folder matches the Set-Up.exe file version. 8. Note - Make sure AdobePIM.dll file version in "resources" folder matches the Set-Up.exe file version.
## Note
1. You can manually download CC Library packge using *libs* sapcode and *kfnt* for Adobe fonts.
2. Batch download is available now.
```
python ccdl-win.py -u 6 -l en_US -p win64 -s phsp,idsn,ilst -x
```

View File

@@ -160,37 +160,18 @@ def app_platform():
return appPlatform return appPlatform
def select_product(products, sapCodes):
for s, d in sapCodes.items():
print("[{}]{}{}".format(s, (10 - len(s)) * " ", d))
def product_code(sapCodes): slectedProduct = None
selectedCode = args.sapCode
if selectedCode:
selectedCode = selectedCode.upper()
if selectedCode and selectedCode not in sapCodes: while slectedProduct is None:
print("\nProvided SAP code ({}) is not available\n".format(selectedCode))
answer = None
while answer is None:
answer = input("Are you want to continue? (y/n): ")
if answer.lower() in ["y", "yes"]:
print("")
selectedCode = None
elif answer.lower() in ["n", "no"]:
print("\nProgram terminated!\n")
exit()
else:
print("\nPlease enter yes or no!")
answer = None
if not selectedCode or selectedCode is None:
for s, d in sapCodes.items():
print("[{}]{}{}".format(s, (10 - len(s)) * " ", d))
while selectedCode 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):
selectedCode = 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:
@@ -199,8 +180,46 @@ def product_code(sapCodes):
val val
) )
) )
return selectedCode return slectedProduct
# for batch download
def product_code(products, sapCodes):
codeList = []
toDown = args.sapCode
if toDown:
toDown = toDown.upper().split(',')
for prodToDown in toDown:
if prodToDown in sapCodes:
print("\nAdd {} to download list".format(prodToDown))
codeList.append(prodToDown)
else:
print("\n{} is not available!\n".format(prodToDown))
answer = None
while answer is None:
answer = input("Are you want to continue? (y/n): ")
if answer.lower() in ["y", "yes"]:
answer = select_product(products, sapCodes)
# for duplicate entry
while answer in codeList:
print("\nAdd {} already exist in donload list".format(answer))
answer = input(
"\nPlease enter the SAP Code of the desired product from the list above: "
).upper()
else:
print("\nAdd {} to download list".format(answer))
codeList.append(answer)
elif answer.lower() in ["n", "no"]:
print("\nProgram terminated!\n")
else:
print("\nPlease enter yes or no!")
answer = None
else:
toDown = select_product(products, sapCodes)
codeList.append(toDown)
return codeList
def product_version(product, versions): def product_version(product, versions):
version = None version = None
@@ -344,7 +363,7 @@ def parse_products_xml(products_url, url_version, allowed_platform, selected_pla
#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 = {}
@@ -898,78 +917,80 @@ def package_download(json, pkg_dir, language, selectedPlatform):
def run_ccdl(products, cdn, sapCodes, selectedPlatform): def run_ccdl(products, cdn, sapCodes, selectedPlatform):
"""Run Main execution.""" """Run Main execution."""
# get product list # get product list
sapCode = product_code(sapCodes) productLists = product_code(products, sapCodes)
product = products.get(sapCode)
# version select for sapCode in productLists:
versions = product["versions"] product = products.get(sapCode)
selectedVersion = product_version(product, versions)
# product to download # version select
prodInfo = versions[selectedVersion] versions = product["versions"]
selectedVersion = product_version(product, versions)
# language select # product to download
supportedLangs = prodInfo["supportedLanguages"] prodInfo = versions[selectedVersion]
installLanguage = install_language(supportedLangs)
# download by manifest url # language select
if sapCode == "APRO": supportedLangs = prodInfo["supportedLanguages"]
download_acrobat(prodInfo, cdn) installLanguage = install_language(supportedLangs)
return
# main product # download by manifest url
print( if sapCode == "APRO":
"\nPrepare to download Adobe {}-{}-{}-{}".format( download_acrobat(prodInfo, cdn)
prodInfo["displayName"], return
prodInfo["productVersion"],
installLanguage,
prodInfo["appPlatform"],
)
)
dest = get_download_path() # main product
print(
# download icons "\nPrepare to download Adobe {}-{}-{}-{}".format(
if args.productIcons: prodInfo["displayName"],
icons_download(prodInfo, dest) prodInfo["productVersion"],
installLanguage,
# create products directory prodInfo["appPlatform"],
products_dir = os.path.join(dest, "products") )
os.makedirs(products_dir, exist_ok=True)
# create product packages dir
package_dir = os.path.join(products_dir, sapCode)
os.makedirs(package_dir, exist_ok=True)
app_json = get_application_json(prodInfo["buildGuid"])
# filter out unused languages from Application.json file
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
):
print("\nCannot download all packages")
if "Dependencies" in app_json:
print("\nDownloading dependency packages")
dependencies_download(
app_json, products, products_dir, installLanguage, selectedPlatform
) )
print("Generating Driver.xml") dest = get_download_path()
prefix = app_json["SAPCode"] + "-"
write_driver_xml(app_json, products_dir, prefix)
print( # download icons
"\nSuccessfully downloaded Adobe {} v-{}".format( if args.productIcons:
prodInfo["displayName"], icons_download(prodInfo, dest)
prodInfo["productVersion"],
# create products directory
products_dir = os.path.join(dest, "products")
os.makedirs(products_dir, exist_ok=True)
# create product packages dir
package_dir = os.path.join(products_dir, sapCode)
os.makedirs(package_dir, exist_ok=True)
app_json = get_application_json(prodInfo["buildGuid"])
# filter out unused languages from Application.json file
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
):
print("\nCannot download all packages")
if "Dependencies" in app_json:
print("\nDownloading dependency packages")
dependencies_download(
app_json, products, products_dir, installLanguage, selectedPlatform
)
print("Generating Driver.xml")
prefix = app_json["SAPCode"] + "-"
write_driver_xml(app_json, products_dir, prefix)
print(
"\nSuccessfully downloaded Adobe {} v-{}".format(
prodInfo["displayName"],
prodInfo["productVersion"],
)
) )
)
return return
@@ -990,7 +1011,7 @@ if __name__ == "__main__":
parser.add_argument( parser.add_argument(
"-s", "-s",
"--sapCode", "--sapCode",
help="SAP code for desired product (eg. PHSP)", help="SAP code for desired product (eg. PHSP). For batch download use comma to separate products",
action="store", action="store",
) )
parser.add_argument( parser.add_argument(
@@ -1042,6 +1063,8 @@ if __name__ == "__main__":
while True: while True:
try: try:
run_ccdl(products, cdn, sapCodes, selectedPlatform) run_ccdl(products, cdn, sapCodes, selectedPlatform)
# cleanup old sapcodes
args.sapCode = None
if args.noRepeatPrompt or not questiony( if args.noRepeatPrompt or not questiony(
"\n\nDo you want to download another package" "\n\nDo you want to download another package"
): ):