Beispiel #1
0
def simple_scanner(path, level):
    try:
        path = path.encode("utf-8")
    except:
        pass
     
    results = []
    if not os.path.exists(path):
        return
    dir = os.path.abspath(path)
    
    list = sort_by_name(path, os.listdir(dir))
    
    for file in list:
        full_path = os.path.join(path, file)
        
        if os.path.isfile(full_path):
            if file_extension(file) not in FC().all_support_formats:
                continue;
        
        if os.path.isdir(full_path):
            if is_dir_with_music(full_path):
                b_bean = FModel(file, full_path).add_parent(level).add_is_file(False)
                results.append(b_bean)
                results.extend(simple_scanner(full_path, b_bean.get_level()))
        elif os.path.isfile(full_path):
            results.append(FModel(file, full_path).add_parent(level).add_is_file(True))
                    
    return results
Beispiel #2
0
def _scanner(path, level):
    try:
        path = path.encode("utf-8")
    except:
        pass

    results = []
    if not os.path.exists(path):
        return None
    dir = os.path.abspath(path)
    list = os.listdir(dir)
    list = sort_by_name(path, list)

    for file in list:
        full_path = os.path.join(path, file)

        if os.path.isfile(full_path) and file_extension(
                file) not in FC().all_support_formats:
            continue

        if is_dir_with_music(full_path):
            b_bean = FModel(file,
                            full_path).add_parent(level).add_is_file(False)
            results.append(b_bean)
            results.extend(_scanner(full_path, b_bean.get_level()))
        elif os.path.isfile(full_path):
            results.append(
                FModel(file, full_path).add_parent(level).add_is_file(True))
    return results
Beispiel #3
0
def _scanner(path, level):
    path = unicode(path)
    results = []
    if not os.path.exists(path):
        return None
    dir = os.path.abspath(path)
    list = os.listdir(dir)
    list = sort_by_name(path, list)

    for file in list:
        full_path = os.path.join(path, file)
        
        if os.path.isfile(full_path) and file_extension(file) not in FC().all_support_formats:
            continue;
        
        if is_dir_with_music(full_path):
            b_bean = FModel(file, full_path).add_parent(level).add_is_file(False)
            results.append(b_bean)
            results.extend(_scanner(full_path, b_bean.get_level()))
        elif os.path.isfile(full_path):
            results.append(FModel(file, full_path).add_parent(level).add_is_file(True))
    return results
Beispiel #4
0
def _scanner(path, level, pr_window):
    try:
        path = path.encode("utf-8")
    except:
        pass

    results = []
    if not os.path.exists(path):
        return
    dir = os.path.abspath(path)

    list = sort_by_name(path, os.listdir(dir))

    for file in list:
        full_path = os.path.join(path, file)

        if os.path.isfile(full_path):
            pr_window.analyzed_files += 1
            if file_extension(file) not in FC().all_support_formats:
                continue

        if os.path.isdir(full_path):
            pr_window.analyzed_folders += 1
            if is_dir_with_music(full_path):
                pr_window.media_folders += 1
                b_bean = FModel(file,
                                full_path).add_parent(level).add_is_file(False)
                results.append(b_bean)
                results.extend(
                    _scanner(full_path, b_bean.get_level(), pr_window))
        elif os.path.isfile(full_path):
            results.append(
                FModel(file, full_path).add_parent(level).add_is_file(True))
            pr_window.media_files += 1

    return results