aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-05-05 19:22:23 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:12:34 +0200
commit03534b3fcfd56f7725b5a558a1c6361a1d6db1da (patch)
tree30f56c563a64f616c0e255f6e779ab5c5468bf0c
parentdfef0a4d86f50820ad0c5ab5c02fdba067df0ff6 (diff)
Fallback to backup image source if download fails for manganelo
-rwxr-xr-xplugins/manganelo.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/plugins/manganelo.py b/plugins/manganelo.py
index 3ce51b8..b19d3e9 100755
--- a/plugins/manganelo.py
+++ b/plugins/manganelo.py
@@ -89,9 +89,24 @@ def download_chapter(url, download_dir):
print("Downloading {} to {}".format(image_source, image_path))
file_size = download_file(image_source, image_path)
if file_size < 255:
- print("resource temporary unavailable: %s" % image_source)
- os.remove(in_progress_filepath)
- exit(2)
+ try_backup_url = False
+ new_image_source = image_source.replace("s3.mkklcdnv3.com", "bu.mkklcdnbuv1.com")
+ if new_image_source != image_source:
+ try_backup_url = True
+ else:
+ new_image_source = image_source.replace("s41.mkklcdnv41.com", "bu.mkklcdnbuv1.com")
+ try_backup_url = (new_image_source != image_source)
+
+ if try_backup_url:
+ file_size = download_file(new_image_source, image_path)
+ if file_size < 255:
+ print("resource temporary unavailable: %s" % new_image_source)
+ os.remove(in_progress_filepath)
+ exit(2)
+ else:
+ print("resource temporary unavailable: %s" % image_source)
+ os.remove(in_progress_filepath)
+ exit(2)
img_number += 1
if img_number == 1: