mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-07-11 15:33:12 +08:00
fix
This commit is contained in:
@@ -499,21 +499,32 @@ class TransferChain(ChainBase, metaclass=Singleton):
|
|||||||
# 所有成功的业务
|
# 所有成功的业务
|
||||||
tasks = self.jobview.success_tasks(task.mediainfo, task.meta.begin_season)
|
tasks = self.jobview.success_tasks(task.mediainfo, task.meta.begin_season)
|
||||||
storagechain = StorageChain()
|
storagechain = StorageChain()
|
||||||
|
downloadhistoryoper = DownloadHistoryOper()
|
||||||
for t in tasks:
|
for t in tasks:
|
||||||
# 下载器hash
|
# 下载器hash
|
||||||
if t.download_hash:
|
if not t.download_hash:
|
||||||
|
continue
|
||||||
|
# 通过download_hash获取种子保存目录
|
||||||
|
download_history = downloadhistoryoper.get_by_hash(t.download_hash)
|
||||||
|
if download_history and download_history.path:
|
||||||
# 检查种子目录下是否还有有效媒体文件
|
# 检查种子目录下是否还有有效媒体文件
|
||||||
if t.fileitem:
|
seed_dir_item = storagechain.get_file_item(storage=t.fileitem.storage,
|
||||||
remain_files = storagechain.list_files(t.fileitem, recursion=True)
|
path=Path(download_history.path))
|
||||||
|
if seed_dir_item and seed_dir_item.type == "dir":
|
||||||
|
remain_files = storagechain.list_files(seed_dir_item, recursion=True)
|
||||||
has_media = any(
|
has_media = any(
|
||||||
f.extension and f.extension.lower() in [ext.lstrip('.') for ext in self.all_exts]
|
f.extension and f.extension.lower() in [ext.lstrip('.') for ext in self.all_exts]
|
||||||
for f in remain_files if f.type == "file")
|
for f in remain_files if f.type == "file"
|
||||||
|
)
|
||||||
if not has_media:
|
if not has_media:
|
||||||
if self.remove_torrents(t.download_hash, downloader=t.downloader):
|
if self.remove_torrents(t.download_hash, downloader=t.downloader):
|
||||||
logger.info(f"移动模式删除种子成功:{t.download_hash} ")
|
logger.info(f"移动模式删除种子成功:{t.download_hash} ")
|
||||||
storagechain.delete_media_file(t.fileitem, delete_self=False)
|
# 删除残留目录
|
||||||
|
if t.fileitem:
|
||||||
|
storagechain.delete_media_file(t.fileitem, delete_self=False)
|
||||||
else:
|
else:
|
||||||
logger.info(f"目录 {t.fileitem.path} 还有未整理的媒体文件,暂不删除种子和残留目录")
|
logger.info(
|
||||||
|
f"种子目录 {download_history.path} 还有未整理的媒体文件,暂不删除种子和残留目录")
|
||||||
# 整理完成且有成功的任务时
|
# 整理完成且有成功的任务时
|
||||||
if self.jobview.is_finished(task):
|
if self.jobview.is_finished(task):
|
||||||
__do_finished()
|
__do_finished()
|
||||||
|
|||||||
Reference in New Issue
Block a user