5
2
mirror of https://github.com/getbible/v2_builder.git synced 2024-11-25 03:57:34 +00:00

Fixed error when file does not exist, that the downloads will continue.

This commit is contained in:
Llewellyn van der Merwe 2022-07-22 18:04:18 +02:00
parent 7c5e878778
commit c748b7caef
Signed by: Llewellyn
GPG Key ID: A9201372263741E7

View File

@ -82,11 +82,17 @@ for sword_name in v1_translation_names:
print('XXX\n{} Download {} failed! {}\nXXX'.format(counter, sword_name, e)) print('XXX\n{} Download {} failed! {}\nXXX'.format(counter, sword_name, e))
# check if this is a legitimate zip file # check if this is a legitimate zip file
if not zipfile.is_zipfile(file_path): if not zipfile.is_zipfile(file_path):
if os.path.exists(file_path):
os.remove(file_path) os.remove(file_path)
if args.no_whiptail: if args.no_whiptail:
print('{} was removed since it has errors...'.format(file_path)) print('{} was removed since it has errors...'.format(file_path))
else: else:
print('XXX\n{}\n{} was removed since it has errors...\nXXX'.format(counter, file_path)) print('XXX\n{}\n{} was removed since it has errors...\nXXX'.format(counter, file_path))
else:
if args.no_whiptail:
print('{} was not downloaded (check the link)...'.format(file_path))
else:
print('XXX\n{}\n{} was not downloaded (check the link)...\nXXX'.format(counter, file_path))
# we try the win repository # we try the win repository
file_url = "https://www.crosswire.org/ftpmirror/pub/sword/packages/win/" + sword_name + ".zip" file_url = "https://www.crosswire.org/ftpmirror/pub/sword/packages/win/" + sword_name + ".zip"
try: try:
@ -102,11 +108,17 @@ for sword_name in v1_translation_names:
print('XXX\n{}\nDownload {} failed! {}\nXXX'.format(counter, sword_name, e)) print('XXX\n{}\nDownload {} failed! {}\nXXX'.format(counter, sword_name, e))
# again check if this is a legitimate zip file # again check if this is a legitimate zip file
if not zipfile.is_zipfile(file_path): if not zipfile.is_zipfile(file_path):
if os.path.exists(file_path):
os.remove(file_path) os.remove(file_path)
if args.no_whiptail: if args.no_whiptail:
print('{} was again removed since it has errors...'.format(file_name)) print('{} was again removed since it has errors...'.format(file_name))
else: else:
print('XXX\n{}\n{} was again removed since it has errors...\nXXX'.format(counter, file_name)) print('XXX\n{}\n{} was again removed since it has errors...\nXXX'.format(counter, file_name))
else:
if args.no_whiptail:
print('{} was not downloaded (check the link)...'.format(file_path))
else:
print('XXX\n{}\n{} was not downloaded (check the link)...\nXXX'.format(counter, file_path))
else: else:
# set local file name # set local file name
folder_path = MAIN_PATH + "/" + sword_name folder_path = MAIN_PATH + "/" + sword_name