aboutsummaryrefslogtreecommitdiffstats
path: root/scanner/TreeWalker.py
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2015-05-26 14:54:54 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2015-05-26 14:55:09 +0200
commitf5696cb075907e22453af709103103b9ab166f44 (patch)
tree5383456f5f558faf2a9f5464c0619528987954e2 /scanner/TreeWalker.py
parentDon't crash when unable to unlink (diff)
downloadPhotoFloat-f5696cb075907e22453af709103103b9ab166f44.tar.xz
PhotoFloat-f5696cb075907e22453af709103103b9ab166f44.zip
Allow masking directories by twiddling permissions.
Diffstat (limited to 'scanner/TreeWalker.py')
-rw-r--r--scanner/TreeWalker.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/scanner/TreeWalker.py b/scanner/TreeWalker.py
index f52873b..b4a4393 100644
--- a/scanner/TreeWalker.py
+++ b/scanner/TreeWalker.py
@@ -19,6 +19,10 @@ class TreeWalker:
message("complete", "")
def walk(self, path):
next_level()
+ if not os.access(path, os.R_OK | os.X_OK):
+ message("access denied", os.path.basename(path))
+ back_level()
+ return None
message("walking", os.path.basename(path))
cache = os.path.join(self.cache_path, json_cache(path))
cached = False
@@ -55,7 +59,9 @@ class TreeWalker:
continue
entry = os.path.join(path, entry)
if os.path.isdir(entry):
- album.add_album(self.walk(entry))
+ next_walked_album = self.walk(entry)
+ if next_walked_album is not None:
+ album.add_album(next_walked_album)
elif not cached and os.path.isfile(entry):
next_level()
cache_hit = False