aboutsummaryrefslogtreecommitdiffstats
path: root/scanner/TreeWalker.py
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2011-05-13 04:06:36 -0400
committerJason A. Donenfeld <Jason@zx2c4.com>2011-05-13 04:06:36 -0400
commit271afa6611eb3efa06d103145f084691cbf23bb6 (patch)
treeac37b76327ed5474d0a19296dd405254b1e1afde /scanner/TreeWalker.py
parentCache nevertheless quick return. (diff)
downloadPhotoFloat-271afa6611eb3efa06d103145f084691cbf23bb6.tar.xz
PhotoFloat-271afa6611eb3efa06d103145f084691cbf23bb6.zip
Rescan corrupted albums.
Diffstat (limited to '')
-rw-r--r--scanner/TreeWalker.py18
1 files changed, 11 insertions, 7 deletions
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):