def func(filename, folder): beans = tree.get_all_beans() if beans: paths = [bean.path for bean in beans if bean.is_file] else: logging.warning(_("It's need not empty playlist")) m3u_writer(filename, folder, paths)
def func(filename, folder): beans = tree.get_all_beans() paths = [] if beans: for bean in beans: if bean.is_file: if not bean.path or bean.path.startswith("http://"): paths.append("##" + bean.text) else: paths.append(bean.path) else: logging.warning(_("It's need not empty playlist")) m3u_writer(filename, folder, paths)
def on_save_playlist(self, tab_child): tree = tab_child.get_child() chooser = gtk.FileChooserDialog(title=_("Choose folder to save playlist"), action=gtk.FILE_CHOOSER_ACTION_SAVE, buttons=(gtk.STOCK_SAVE, gtk.RESPONSE_OK)) chooser.set_default_response(gtk.RESPONSE_OK) if FC().last_music_path: chooser.set_current_folder(FC().last_music_path) name = self.get_text_label_from_tab(tab_child) chooser.set_current_name(name + ".m3u") chooser.set_do_overwrite_confirmation(True) response = chooser.run() if response == gtk.RESPONSE_OK: beans = tree.get_all_beans() if beans: paths = [bean.path for bean in beans if bean.is_file] filename = chooser.get_filename() current_folder = chooser.get_current_folder() m3u_writer(filename, current_folder, paths) chooser.destroy()