fix actions

This commit is contained in:
jxxghp
2025-02-28 11:56:26 +08:00
parent cf62ad5e8e
commit a9644c4f86
10 changed files with 50 additions and 33 deletions
+7 -5
View File
@@ -19,7 +19,8 @@ class TransferFileAction(BaseAction):
整理文件
"""
__fileitems = []
_fileitems = []
_has_error = False
def __init__(self):
super().__init__()
@@ -43,7 +44,7 @@ class TransferFileAction(BaseAction):
@property
def success(self) -> bool:
return True if self.__fileitems else False
return not self._has_error
def execute(self, params: dict, context: ActionContext) -> ActionContext:
"""
@@ -60,13 +61,14 @@ class TransferFileAction(BaseAction):
logger.info(f"开始整理文件 {download.path} ...")
state, errmsg = self.transferchain.do_transfer(fileitem, background=False)
if not state:
self._has_error = True
logger.error(f"整理文件 {download.path} 失败: {errmsg}")
continue
logger.info(f"整理文件 {download.path} 完成")
self.__fileitems.append(fileitem)
self._fileitems.append(fileitem)
if self.__fileitems:
context.fileitems.extend(self.__fileitems)
if self._fileitems:
context.fileitems.extend(self._fileitems)
self.job_done()
return context