def add_tasks(self, pcs_files, dirname='<STR_LIT>'):
def on_list_dir(info, error=None):<EOL><INDENT>path, pcs_files = info<EOL>if error or not pcs_files:<EOL><INDENT>dialog = Gtk.MessageDialog(self.app.window,<EOL>Gtk.DialogFlags.MODAL,<EOL>Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE,<EOL>_('<STR_LIT>'))<EOL>dialog.format_secondary_text(<EOL>_('<STR_LIT>').format(path))<EOL>dialog.run()<EOL>dialog.destroy()<EOL>return<EOL><DEDENT>self.add_tasks(pcs_files, dirname)<EOL><DEDENT>self.check_first()<EOL>for pcs_file in pcs_files:<EOL><INDENT>if pcs_file['<STR_LIT>']:<EOL><INDENT>gutil.async_call(pcs.list_dir_all, self.app.cookie,<EOL>self.app.tokens, pcs_file['<STR_LIT:path>'],<EOL>callback=on_list_dir)<EOL><DEDENT>else:<EOL><INDENT>self.add_task(pcs_file, dirname)<EOL><DEDENT><DEDENT>self.check_commit(force=True)<EOL>
建立批量下载任务, 包括目录