Dolda2000 GitWeb
/
automanga.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6e3b8ae
)
Delete getmanga output files that aren't properly completed.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Fri, 19 May 2017 15:10:00 +0000
(17:10 +0200)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Fri, 19 May 2017 15:10:00 +0000
(17:10 +0200)
getmanga
patch
|
blob
|
blame
|
history
diff --git
a/getmanga
b/getmanga
index
c744617
..
7dea808
100755
(executable)
--- a/
getmanga
+++ b/
getmanga
@@
-83,11
+83,17
@@
def download(mng, tdir, pattern):
msg(1, "getting %s...", nm)
with page.open() as fp:
with open(path, "wb") as out:
- while True:
- data = fp.read(65536)
- if data == b"":
- break
- out.write(data)
+ done = False
+ try:
+ while True:
+ data = fp.read(65536)
+ if data == b"":
+ done = True
+ break
+ out.write(data)
+ finally:
+ if not done:
+ os.unlink(path)
try:
img = Image.open(path)
except OSError: