diff danboorufs.py @ 7:09945ce42e28 draft

Allow multiple base directories.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 20 Dec 2012 18:32:34 +0100
parents 2c81cc41de2d
children c93cfd58112e
line wrap: on
line diff
--- a/danboorufs.py
+++ b/danboorufs.py
@@ -191,16 +191,17 @@ def main(args):
 
     if args[1] == '-n' or args[1] == '--no-symlinks':
         use_symlinks = False
-        directory = args[2]
+        directories = args[2:]
     else:
         use_symlinks = True
-        directory = args[1]
+        directories = args[1:]
 
     filelist = []
     start = time()
-    for (path, _, files) in os.walk(directory):
-        filelist.extend(os.path.join(path, filename) for filename in files
-                        if filename.endswith('.tags'))
+    for directory in directories:
+        for (path, _, files) in os.walk(directory):
+            filelist.extend(os.path.join(path, filename) for filename in files
+                            if filename.endswith('.tags'))
     print('[%d] Walk done.' % (time() - start))
 
     FUSE(Danbooru(filelist, os.path.dirname(mountpoint), use_symlinks),