From 6105d4011abc8149f9a70c4e1a247ba5ebe4ca62 Mon Sep 17 00:00:00 2001 From: thsrite Date: Thu, 27 Jun 2024 14:04:42 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=88=A0=E9=99=A4=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=9A=84=E6=97=B6=E5=80=99=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=90=8C=E5=90=8D=E5=88=AE=E5=89=8A=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/libraryduplicatecheck/__init__.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/libraryduplicatecheck/__init__.py b/plugins/libraryduplicatecheck/__init__.py index f415338..9a763a7 100644 --- a/plugins/libraryduplicatecheck/__init__.py +++ b/plugins/libraryduplicatecheck/__init__.py @@ -238,9 +238,16 @@ class LibraryDuplicateCheck(_PluginBase): # 同步删除软连接源目录 if cloud_file and Path(cloud_file).exists() and self._delete_softlink: - Path(cloud_file).unlink() delete_cloud_files += 1 - logger.info(f"云盘文件 {cloud_file} 已删除") + cloud_file_path = Path(cloud_file) + # 删除文件、nfo、jpg等同名文件 + pattern = cloud_file_path.stem.replace('[', '?').replace(']', '?') + logger.info(f"开始筛选 {cloud_file_path.parent} 下同名文件 {pattern}") + files = cloud_file_path.parent.glob(f"{pattern}.*") + for file in files: + Path(file).unlink() + logger.info(f"云盘文件 {file} 已删除") + self.__rmtree(Path(cloud_file), "云盘") else: logger.info(f"'{name}' No Duplicate video files.")