From 271afa6611eb3efa06d103145f084691cbf23bb6 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 13 May 2011 04:06:36 -0400 Subject: Rescan corrupted albums. --- scanner/TreeWalker.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'scanner/TreeWalker.py') diff --git a/scanner/TreeWalker.py b/scanner/TreeWalker.py index e1e98d6..e9df64e 100644 --- a/scanner/TreeWalker.py +++ b/scanner/TreeWalker.py @@ -23,13 +23,17 @@ class TreeWalker: cached_album = None if os.path.exists(cache): print "Has cache %s" % path - cached_album = Album.from_cache(cache) - if file_mtime(path) <= file_mtime(cache): - print "Album is fully cached" - cached = True - album = cached_album - for photo in album.photos: - self.all_photos.append(photo) + try: + cached_album = Album.from_cache(cache) + if file_mtime(path) <= file_mtime(cache): + print "Album is fully cached" + cached = True + album = cached_album + for photo in album.photos: + self.all_photos.append(photo) + except: + print "Cache is corrupted. Rescanning album." + cached_album = None if not cached: album = Album(path) for entry in os.listdir(path): -- cgit v1.2.3-59-g8ed1b