From 58acc62e165de4f745df315fb579306835c91ea3 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Mon, 27 May 2024 08:11:44 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E7=A1=AC=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E8=BD=AC=E5=A4=8D=E5=88=B6=E6=97=B6=E5=8F=91=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chain/transfer.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/chain/transfer.py b/app/chain/transfer.py index f481b1c8..58e4d562 100644 --- a/app/chain/transfer.py +++ b/app/chain/transfer.py @@ -18,6 +18,7 @@ from app.db.systemconfig_oper import SystemConfigOper from app.db.transferhistory_oper import TransferHistoryOper from app.helper.directory import DirectoryHelper from app.helper.format import FormatParser +from app.helper.message import MessageHelper from app.helper.progress import ProgressHelper from app.log import logger from app.schemas import TransferInfo, TransferTorrent, Notification, EpisodeFormat @@ -43,6 +44,7 @@ class TransferChain(ChainBase): self.tmdbchain = TmdbChain() self.systemconfig = SystemConfigOper() self.directoryhelper = DirectoryHelper() + self.messagehelper = MessageHelper() def process(self) -> bool: """ @@ -352,10 +354,20 @@ class TransferChain(ChainBase): transfers[mkey].file_list_new.extend(transferinfo.file_list_new) transfers[mkey].fail_list.extend(transferinfo.fail_list) + # 硬链接检查 + temp_transfer_type = transfer_type + if transfer_type == "link": + if not SystemUtils.is_same_disk(file_path, transferinfo.target_path): + logger.warn(f"{file_path} 与 {transferinfo.target_path} 不在同一磁盘/存储空间/映射目录,未能硬链接,请检查存储空间占用和整理耗时,确认是否为复制") + self.messagehelper.put(f"{file_path} 与 {transferinfo.target_path} 不在同一磁盘/存储空间/映射目录,疑似硬链接失败,请检查是否为复制", + title="硬链接失败", + role="system") + temp_transfer_type = "copy" + # 新增转移成功历史记录 self.transferhis.add_success( src_path=file_path, - mode=transfer_type, + mode=temp_transfer_type, download_hash=download_hash, meta=file_meta, mediainfo=file_mediainfo, @@ -365,7 +377,7 @@ class TransferChain(ChainBase): if transferinfo.need_scrape: self.scrape_metadata(path=transferinfo.target_path, mediainfo=file_mediainfo, - transfer_type=transfer_type, + transfer_type=temp_transfer_type, metainfo=file_meta) # 更新进度 processed_num += 1