diff --git a/client/djrandom_client/filescan.py b/client/djrandom_client/filescan.py index e8410387ba2218ff5578c1e18d5e10237c40affb..a209c08a2d3d4c7b7c05c5f21d16bdc94a99b1b8 100644 --- a/client/djrandom_client/filescan.py +++ b/client/djrandom_client/filescan.py @@ -1,11 +1,19 @@ import os +DIR_BLACKLIST = set(['.AppleDouble']) + def recursive_scan(basedir, queue): n = 0 - for root, dirs, files in os.walk(basedir): + for root, dirs, files in os.walk(basedir, topdown=True, + followlinks=True): + prune_dirs = [x for x in dirs + if (x in DIR_BLACKLIST or x.startswith('.'))] + for pdir in prune_dirs: + dirs.remove(pdir) for filename in files: - if filename.lower().endswith('.mp3'): + if (filename.lower().endswith('.mp3') and + not filename.startswith('.')): path = os.path.join(root, filename) queue.put(path) n += 1