aboutsummaryrefslogtreecommitdiff
path: root/plugins/manganelo.py
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-04-20 00:57:21 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:12:34 +0200
commit6f1afa9d76e9c2611a8025fb067d7ee14518dc18 (patch)
treec4345e2c68a2a364422516eda29d28d8e2acb6c9 /plugins/manganelo.py
parent1294ab9559a872f5c66211190f7e4ef3f6709df1 (diff)
Remove in_progress file for manga if download fails
Diffstat (limited to 'plugins/manganelo.py')
-rwxr-xr-xplugins/manganelo.py5
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: