def on_add_folders(self, paths=None): if not paths: paths = directory_chooser_dialog(_("Choose folders to open"), FC().last_dir) if paths: path = paths[0] list = path.split("/") FC().last_dir = path[:path.rfind("/")] name = list[len(list) - 1] parent = FModel(name) self.append_to_new_notebook(name, []) all_beans = [] all_beans.append(parent) for path in paths: if path == "/": logging.info("Skip root folder") continue; beans = get_all_music_by_path(path) for bean in beans: if not bean.is_file: bean.parent(parent).add_is_file(False) all_beans.append(bean) if all_beans: self.append_to_current_notebook(all_beans) else: self.append([self.SearchCriteriaBeen(_("Nothing found to play in the folder(s)") + paths[0])])
def update_music_tree(self, tree=None, number_of_page=0): if not tree: tree = self.tree logging.info("Update music tree" + str(FC().music_paths[number_of_page])) tree.clear_tree() FC().cache_music_tree_beans[number_of_page] = [] all = [] for path in FC().music_paths[number_of_page]: all_in_folder = get_all_music_by_path(path) if all_in_folder: for bean in all_in_folder: all.append(bean) for bean in all: FC().cache_music_tree_beans[number_of_page].append(bean) try: self.perspective.hide_add_button() except AttributeError: logging.warn("Object perspective not exists yet") if not all: tree.is_empty = True try: self.perspective.show_add_button() except AttributeError: logging.warn("Object perspective not exists yet") all.append(FModel(_("Music not found in folder(s):"))) for path in FC().music_paths[number_of_page]: all.append(FModel(path).add_is_file(True)) else: tree.is_empty = False tree.append_all(all)
def update_music_tree(self, tree=None, number_of_page=0): if not tree: tree = self.tree logging.info("Update music tree" + str(FCache().music_paths[number_of_page])) tree.clear_tree() FCache().cache_music_tree_beans[number_of_page] = [] all = [] for path in FCache().music_paths[number_of_page]: all_in_folder = get_all_music_by_path(path) if all_in_folder: for bean in all_in_folder: all.append(bean) for bean in all: FCache().cache_music_tree_beans[number_of_page].append(bean) try: self.perspective.hide_add_button() except AttributeError: logging.warn("Object perspective not exists yet") if not all: tree.is_empty = True try: self.perspective.show_add_button() except AttributeError: logging.warn("Object perspective not exists yet") all.append(FModel(_("Music not found in folder(s):"))) for path in FCache().music_paths[number_of_page]: all.append(FModel(path).add_is_file(True)) else: tree.is_empty = False tree.append_all(all) tree.ext_width = tree.ext_column.get_width()
def task(): path = paths[0] list = path.split("/") FC().last_dir = path[:path.rfind("/")] name = list[len(list) - 1] parent = FModel(name) self.append_to_new_notebook(name, []) all_beans = [] all_beans.append(parent) for path in paths: if path == "/": logging.info("Skip root folder") continue; beans = get_all_music_by_path(path) for bean in beans: if not bean.is_file: bean.parent(parent).add_is_file(False) all_beans.append(bean) if all_beans: self.append_to_current_notebook(all_beans) else: self.append([self.SearchCriteriaBeen(_("Nothing found to play in the folder(s)") + paths[0])])
def get_beans_from_iso_wv(path): if path and path.lower().endswith("iso.wv"): mount_path = mount_tmp_iso(path) return get_all_music_by_path(mount_path)