aboutsummaryrefslogtreecommitdiffstats
path: root/scanner/TreeWalker.py
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2011-05-12 21:38:14 -0400
committerJason A. Donenfeld <Jason@zx2c4.com>2011-05-12 21:38:14 -0400
commit567f38e88bea6f9e1c08dcc0eed3e2efad55b777 (patch)
tree7a35454fde1cab6930c9e9d8c20be3960ca2711d /scanner/TreeWalker.py
parentMake generic as well. (diff)
downloadPhotoFloat-567f38e88bea6f9e1c08dcc0eed3e2efad55b777.tar.xz
PhotoFloat-567f38e88bea6f9e1c08dcc0eed3e2efad55b777.zip
Fix unicode error for Espen.
Diffstat (limited to 'scanner/TreeWalker.py')
-rw-r--r--scanner/TreeWalker.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/scanner/TreeWalker.py b/scanner/TreeWalker.py
index 691900a..e1e98d6 100644
--- a/scanner/TreeWalker.py
+++ b/scanner/TreeWalker.py
@@ -1,5 +1,6 @@
import os
import os.path
+import sys
from datetime import datetime
from PhotoAlbum import Photo, Album, PhotoAlbumEncoder
from CachePath import json_cache, set_cache_path_base, file_mtime
@@ -34,6 +35,10 @@ class TreeWalker:
for entry in os.listdir(path):
if entry[0] == '.':
continue
+ try:
+ entry = entry.decode(sys.getfilesystemencoding())
+ except:
+ pass
entry = os.path.join(path, entry)
if os.path.isdir(entry):
album.add_album(self.walk(entry))
@@ -83,6 +88,10 @@ class TreeWalker:
all_cache_entries[entry] = True
print "Searching stale cache entries."
for cache in os.listdir(self.cache_path):
+ try:
+ cache = cache.decode(sys.getfilesystemencoding())
+ except:
+ pass
if cache not in all_cache_entries:
print "Removing stale cache %s" % cache
os.unlink(os.path.join(self.cache_path, cache))