From 0443b99492b0d52bc38635a9522de3947b41d6df Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Sat, 21 Dec 2013 20:46:56 -0500 Subject: [PATCH] If thumbing or transcoding fails, invalidate entry. --- scanner/PhotoAlbum.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scanner/PhotoAlbum.py b/scanner/PhotoAlbum.py index 368b1d5..d89733c 100644 --- a/scanner/PhotoAlbum.py +++ b/scanner/PhotoAlbum.py @@ -242,6 +242,7 @@ class Photo(object): except KeyboardInterrupt: raise except: + self.is_valid = False return info = json.loads(p) for s in info["streams"]: @@ -279,6 +280,7 @@ class Photo(object): raise except: message("corrupt image", os.path.basename(original_path)) + self.is_valid = False return if square: if image.size[0] > image.size[1]: @@ -302,6 +304,7 @@ class Photo(object): except: message("save failure", os.path.basename(thumb_path)) os.unlink(thumb_path) + self.is_valid = False def _photo_thumbnails(self, image, thumb_path, original_path): mirror = image @@ -339,6 +342,7 @@ class Photo(object): except: message("couldn't extract video frame", os.path.basename(original_path)) os.unlink(tfn) + self.is_valid = False return try: image = Image.open(tfn) @@ -347,6 +351,7 @@ class Photo(object): except: message("couldn't open video thumbnail", tfn) os.unlink(tfn) + self.is_valid = False return mirror = image if "rotate" in self._attributes: @@ -392,6 +397,7 @@ class Photo(object): os.unlink(transcode_path) except: pass + self.is_valid = False return self._video_metadata(transcode_path, False)