diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2011-05-09 09:33:30 -0400 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2011-05-09 09:33:30 -0400 |
commit | 6d75a3ed642529a99227d578f74ec14bd7e03d42 (patch) | |
tree | 069d55637f78bdaaf9c4cb6a1bf35e85b40bf619 | |
parent | Better titles. (diff) | |
download | PhotoFloat-6d75a3ed642529a99227d578f74ec14bd7e03d42.tar.xz PhotoFloat-6d75a3ed642529a99227d578f74ec14bd7e03d42.zip |
To work around Espen's corrupted image bug, we simply try to copy the image twice. The second time will usually work, unless the file is totally borked.
-rw-r--r-- | scanner/PhotoAlbum.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/scanner/PhotoAlbum.py b/scanner/PhotoAlbum.py index 6e209e7..f21345f 100644 --- a/scanner/PhotoAlbum.py +++ b/scanner/PhotoAlbum.py @@ -207,7 +207,14 @@ class Photo(object): if os.path.exists(thumb_path) and file_mtime(thumb_path) >= self._attributes["dateTimeFile"]: return gc.collect() - image = image.copy() + try: + image = image.copy() + except: + try: + image = image.copy() # we try again to work around PIL bug + except: + print "Image is corrupted. %s will not be created." % thumb_path + return if square: if image.size[0] > image.size[1]: left = (image.size[0] - image.size[1]) / 2 |