Rescan corrupted albums.

master
Jason A. Donenfeld 2011-05-13 04:06:36 -04:00
parent 7e48878a81
commit 271afa6611
1 changed files with 11 additions and 7 deletions

View File

@ -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):