def _scanner(path, level): 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())) 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
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