mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-09 01:16:50 +08:00
v2.3.2
- 任务工作流支持手动停止、支持导入导出流程数据、完善动作组件等
This commit is contained in:
@@ -58,6 +58,15 @@ class TransferFileAction(BaseAction):
|
|||||||
"""
|
"""
|
||||||
从 downloads / fileitems 中整理文件,记录到fileitems
|
从 downloads / fileitems 中整理文件,记录到fileitems
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def check_continue():
|
||||||
|
"""
|
||||||
|
检查是否继续整理文件
|
||||||
|
"""
|
||||||
|
if global_vars.is_workflow_stopped(workflow_id):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
params = TransferFileParams(**params)
|
params = TransferFileParams(**params)
|
||||||
if params.source == "downloads":
|
if params.source == "downloads":
|
||||||
# 从下载任务中整理文件
|
# 从下载任务中整理文件
|
||||||
@@ -86,14 +95,15 @@ class TransferFileAction(BaseAction):
|
|||||||
else:
|
else:
|
||||||
# 从 fileitems 中整理文件
|
# 从 fileitems 中整理文件
|
||||||
for fileitem in copy.deepcopy(context.fileitems):
|
for fileitem in copy.deepcopy(context.fileitems):
|
||||||
if global_vars.is_workflow_stopped(workflow_id):
|
if not check_continue():
|
||||||
break
|
break
|
||||||
transferd = self.transferhis.get_by_src(fileitem.path, storage=fileitem.storage)
|
transferd = self.transferhis.get_by_src(fileitem.path, storage=fileitem.storage)
|
||||||
if transferd:
|
if transferd:
|
||||||
# 已经整理过的文件不再整理
|
# 已经整理过的文件不再整理
|
||||||
continue
|
continue
|
||||||
logger.info(f"开始整理文件 {fileitem.path} ...")
|
logger.info(f"开始整理文件 {fileitem.path} ...")
|
||||||
state, errmsg = self.transferchain.do_transfer(fileitem, background=False)
|
state, errmsg = self.transferchain.do_transfer(fileitem, background=False,
|
||||||
|
continue_callback=check_continue)
|
||||||
if not state:
|
if not state:
|
||||||
self._has_error = True
|
self._has_error = True
|
||||||
logger.error(f"整理文件 {fileitem.path} 失败: {errmsg}")
|
logger.error(f"整理文件 {fileitem.path} 失败: {errmsg}")
|
||||||
|
|||||||
@@ -905,7 +905,7 @@ class TransferChain(ChainBase, metaclass=Singleton):
|
|||||||
season: int = None, epformat: EpisodeFormat = None, min_filesize: int = 0,
|
season: int = None, epformat: EpisodeFormat = None, min_filesize: int = 0,
|
||||||
downloader: str = None, download_hash: str = None,
|
downloader: str = None, download_hash: str = None,
|
||||||
force: bool = False, background: bool = True,
|
force: bool = False, background: bool = True,
|
||||||
manual: bool = False) -> Tuple[bool, str]:
|
manual: bool = False, continue_callback: Callable = None) -> Tuple[bool, str]:
|
||||||
"""
|
"""
|
||||||
执行一个复杂目录的整理操作
|
执行一个复杂目录的整理操作
|
||||||
:param fileitem: 文件项
|
:param fileitem: 文件项
|
||||||
@@ -926,6 +926,7 @@ class TransferChain(ChainBase, metaclass=Singleton):
|
|||||||
:param force: 是否强制整理
|
:param force: 是否强制整理
|
||||||
:param background: 是否后台运行
|
:param background: 是否后台运行
|
||||||
:param manual: 是否手动整理
|
:param manual: 是否手动整理
|
||||||
|
:param continue_callback: 继续处理回调
|
||||||
返回:成功标识,错误信息
|
返回:成功标识,错误信息
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -991,6 +992,8 @@ class TransferChain(ChainBase, metaclass=Singleton):
|
|||||||
for file_item, bluray_dir in file_items:
|
for file_item, bluray_dir in file_items:
|
||||||
if global_vars.is_system_stopped:
|
if global_vars.is_system_stopped:
|
||||||
break
|
break
|
||||||
|
if continue_callback and not continue_callback():
|
||||||
|
break
|
||||||
file_path = Path(file_item.path)
|
file_path = Path(file_item.path)
|
||||||
# 回收站及隐藏的文件不处理
|
# 回收站及隐藏的文件不处理
|
||||||
if file_item.path.find('/@Recycle/') != -1 \
|
if file_item.path.find('/@Recycle/') != -1 \
|
||||||
@@ -1111,6 +1114,8 @@ class TransferChain(ChainBase, metaclass=Singleton):
|
|||||||
for transfer_task in transfer_tasks:
|
for transfer_task in transfer_tasks:
|
||||||
if global_vars.is_system_stopped:
|
if global_vars.is_system_stopped:
|
||||||
break
|
break
|
||||||
|
if continue_callback and not continue_callback():
|
||||||
|
break
|
||||||
# 更新进度
|
# 更新进度
|
||||||
__process_msg = f"正在整理 ({processed_num + fail_num + 1}/{total_num}){transfer_task.fileitem.name} ..."
|
__process_msg = f"正在整理 ({processed_num + fail_num + 1}/{total_num}){transfer_task.fileitem.name} ..."
|
||||||
logger.info(__process_msg)
|
logger.info(__process_msg)
|
||||||
|
|||||||
+2
-2
@@ -1,2 +1,2 @@
|
|||||||
APP_VERSION = 'v2.3.1'
|
APP_VERSION = 'v2.3.2'
|
||||||
FRONTEND_VERSION = 'v2.3.1'
|
FRONTEND_VERSION = 'v2.3.2'
|
||||||
|
|||||||
Reference in New Issue
Block a user