mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-07-12 16:02:35 +08:00
add ScanFileAction
This commit is contained in:
@@ -59,6 +59,9 @@ class FetchDownloadsAction(BaseAction):
|
|||||||
if t.progress >= 100:
|
if t.progress >= 100:
|
||||||
logger.info(f"下载任务 {download.download_id} 已完成")
|
logger.info(f"下载任务 {download.download_id} 已完成")
|
||||||
download.completed = True
|
download.completed = True
|
||||||
|
else:
|
||||||
|
logger.info(f"下载任务 {download.download_id} 未完成")
|
||||||
|
download.completed = False
|
||||||
if all([d.completed for d in self._downloads]):
|
if all([d.completed for d in self._downloads]):
|
||||||
self.job_done()
|
self.job_done()
|
||||||
return context
|
return context
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from pydantic import Field
|
|||||||
|
|
||||||
from app.actions import BaseAction
|
from app.actions import BaseAction
|
||||||
from app.core.config import global_vars
|
from app.core.config import global_vars
|
||||||
|
from app.db.transferhistory_oper import TransferHistoryOper
|
||||||
from app.schemas import ActionParams, ActionContext
|
from app.schemas import ActionParams, ActionContext
|
||||||
from app.chain.storage import StorageChain
|
from app.chain.storage import StorageChain
|
||||||
from app.chain.transfer import TransferChain
|
from app.chain.transfer import TransferChain
|
||||||
@@ -32,6 +33,7 @@ class TransferFileAction(BaseAction):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
self.transferchain = TransferChain()
|
self.transferchain = TransferChain()
|
||||||
self.storagechain = StorageChain()
|
self.storagechain = StorageChain()
|
||||||
|
self.transferhis = TransferHistoryOper()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@property
|
@property
|
||||||
@@ -69,6 +71,10 @@ class TransferFileAction(BaseAction):
|
|||||||
if not fileitem:
|
if not fileitem:
|
||||||
logger.info(f"文件 {download.path} 不存在")
|
logger.info(f"文件 {download.path} 不存在")
|
||||||
continue
|
continue
|
||||||
|
transferd = self.transferhis.get_by_src(fileitem.path, storage=fileitem.storage)
|
||||||
|
if transferd:
|
||||||
|
# 已经整理过的文件不再整理
|
||||||
|
continue
|
||||||
logger.info(f"开始整理文件 {download.path} ...")
|
logger.info(f"开始整理文件 {download.path} ...")
|
||||||
state, errmsg = self.transferchain.do_transfer(fileitem, background=False)
|
state, errmsg = self.transferchain.do_transfer(fileitem, background=False)
|
||||||
if not state:
|
if not state:
|
||||||
@@ -82,6 +88,10 @@ class TransferFileAction(BaseAction):
|
|||||||
for fileitem in copy.deepcopy(context.fileitems):
|
for fileitem in copy.deepcopy(context.fileitems):
|
||||||
if global_vars.is_workflow_stopped(workflow_id):
|
if global_vars.is_workflow_stopped(workflow_id):
|
||||||
break
|
break
|
||||||
|
transferd = self.transferhis.get_by_src(fileitem.path, storage=fileitem.storage)
|
||||||
|
if transferd:
|
||||||
|
# 已经整理过的文件不再整理
|
||||||
|
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)
|
||||||
if not state:
|
if not state:
|
||||||
|
|||||||
Reference in New Issue
Block a user