Ejemplo n.º 1
0
def getDirectories(l, root, hidden=False):
    root = os.path.realpath(root) + os.sep
    if not autoNetwork.isMountOnline(root):
        print("not connected:", root)
        return
    if not os.path.exists(root):
        print("path not exists:", root)
        return
    if not root in l:
        l.append(root)
    for entry in os.listdir(root):
        try:
            if not hidden and entry.startswith('.'):
                continue
            dir_path = os.path.join(root, entry)
            if not os.path.isdir(dir_path):
                continue
            dir_path = os.path.realpath(dir_path) + os.sep
            # Skip excluded directories here
            if any(item.lower() in dir_path.lower() for item in SCAN_EXCLUDE):
                print("skip folder: \"%s\"" % (dir_path))
                continue
            dvd = detectDVDStructure(dir_path)
            bludisc = detectBludiscStructure(dir_path)
            if dvd or bludisc:
                continue
            if not dir_path in l:
                l.append(dir_path)
            getDirectories(l, dir_path, hidden)
        except:
            printStackTrace()
Ejemplo n.º 2
0
def getDirectories(l, root, hidden=False):
    root = os.path.realpath(root) + os.sep
    if not autoNetwork.isMountOnline(root):
        print "not connected:", root
        return
    if not os.path.exists(root):
        print "path not exists:", root
        return
    if not root in l:
        l.append(root)
    for entry in os.listdir(root):
        try:
            if not hidden and entry.startswith('.'):
                continue
            dir_path = os.path.join(root, entry)
            if not os.path.isdir(dir_path):
                continue
            dir_path = os.path.realpath(dir_path) + os.sep
            # Skip excluded directories here
            if any(item.lower() in dir_path.lower() for item in SCAN_EXCLUDE):
                print "skip folder: \"%s\"" % (dir_path)
                continue
            dvd = detectDVDStructure(dir_path)
            bludisc = detectBludiscStructure(dir_path)
            if dvd or bludisc:
                continue
            if not dir_path in l:
                l.append(dir_path)
            getDirectories(l, dir_path, hidden)
        except:
            printStackTrace()