diff options
Diffstat (limited to 'plugins/manganelo.py')
-rwxr-xr-x | plugins/manganelo.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/manganelo.py b/plugins/manganelo.py index d8b5c9a..3cb3118 100755 --- a/plugins/manganelo.py +++ b/plugins/manganelo.py @@ -33,7 +33,8 @@ if len(sys.argv) < 2: def download_file(url, save_path): file_size = 0 with requests.get(url, stream=True) as response: - response.raise_for_status() + if not response.ok(): + return 0 with open(save_path, "wb") as file: for chunk in response.iter_content(chunk_size=8192): if chunk: @@ -89,11 +90,13 @@ def download_chapter(url, download_dir): 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) img_number += 1 if img_number == 1: print("Failed to find images for chapter") + os.remove(in_progress_filepath) exit(2) with open(os.path.join(download_dir, ".finished"), "w") as file: |