Mercurial > danboorufs
comparison 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 |
comparison
equal
deleted
inserted
replaced
6:2c81cc41de2d | 7:09945ce42e28 |
---|---|
189 def main(args): | 189 def main(args): |
190 mountpoint = args.pop() | 190 mountpoint = args.pop() |
191 | 191 |
192 if args[1] == '-n' or args[1] == '--no-symlinks': | 192 if args[1] == '-n' or args[1] == '--no-symlinks': |
193 use_symlinks = False | 193 use_symlinks = False |
194 directory = args[2] | 194 directories = args[2:] |
195 else: | 195 else: |
196 use_symlinks = True | 196 use_symlinks = True |
197 directory = args[1] | 197 directories = args[1:] |
198 | 198 |
199 filelist = [] | 199 filelist = [] |
200 start = time() | 200 start = time() |
201 for (path, _, files) in os.walk(directory): | 201 for directory in directories: |
202 filelist.extend(os.path.join(path, filename) for filename in files | 202 for (path, _, files) in os.walk(directory): |
203 if filename.endswith('.tags')) | 203 filelist.extend(os.path.join(path, filename) for filename in files |
204 if filename.endswith('.tags')) | |
204 print('[%d] Walk done.' % (time() - start)) | 205 print('[%d] Walk done.' % (time() - start)) |
205 | 206 |
206 FUSE(Danbooru(filelist, os.path.dirname(mountpoint), use_symlinks), | 207 FUSE(Danbooru(filelist, os.path.dirname(mountpoint), use_symlinks), |
207 mountpoint, foreground=True) | 208 mountpoint, foreground=True) |
208 | 209 |