From 9e8f80a0586772f84489a4e818a6dbedb4ff0076 Mon Sep 17 00:00:00 2001 From: thsrite Date: Thu, 27 Jun 2024 16:10:27 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BB=85=E6=A3=80=E6=9F=A5=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=EF=BC=8C=E9=A2=84=E8=A7=88=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E4=B8=8D=E4=BC=9A=E5=88=A0=E9=99=A4=E4=BB=BB=E4=BD=95=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- package.json | 3 ++- plugins/libraryduplicatecheck/__init__.py | 10 ++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f69f49c..eba8929 100644 --- a/README.md +++ b/README.md @@ -46,4 +46,4 @@ MoviePilot三方插件市场:https://github.com/thsrite/MoviePilot-Plugins/ - CloudDrive2助手 v1.2 - 软连接重定向 v1.0 - 云盘同步删除 v1.3 -- 媒体库重复媒体检测 v1.7 \ No newline at end of file +- 媒体库重复媒体检测 v1.8 \ No newline at end of file diff --git a/package.json b/package.json index 2ccff50..9631f48 100644 --- a/package.json +++ b/package.json @@ -588,11 +588,12 @@ "name": "媒体库重复媒体检测", "description": "媒体库重复媒体检查,可选保留规则保留其一。", "labels": "云盘,媒体库", - "version": "1.7", + "version": "1.8", "icon": "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/libraryduplicate.png", "author": "thsrite", "level": 2, "history": { + "v1.8": "仅检查模式下,预览操作不会删除任何文件。", "v1.7": "修复特殊场景下删除问题", "v1.6": "同步删除thumb图片等刮削文件", "v1.5": "删除重复文件时再刷新媒体库逻辑", diff --git a/plugins/libraryduplicatecheck/__init__.py b/plugins/libraryduplicatecheck/__init__.py index 3ef9ab5..d2a1bf5 100644 --- a/plugins/libraryduplicatecheck/__init__.py +++ b/plugins/libraryduplicatecheck/__init__.py @@ -30,7 +30,7 @@ class LibraryDuplicateCheck(_PluginBase): # 插件图标 plugin_icon = "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/libraryduplicate.png" # 插件版本 - plugin_version = "1.7" + plugin_version = "1.8" # 插件作者 plugin_author = "thsrite" # 作者主页 @@ -248,9 +248,11 @@ class LibraryDuplicateCheck(_PluginBase): logger.info(f" {path} 文件已被删除") # Decide which file to keep based on criteria (e.g., file size or creation date) + logger.info(f"文件保留规则:{str(retain_type)}") keep_file = self.__choose_file_to_keep(paths, retain_type) - logger.info(f"文件保留规则:{str(retain_type)} Keeping: {keep_file}") + logger.info(f"本地保留文件: {keep_file}") keep_cloud_file = os.readlink(str(keep_file)) + logger.info(f"云盘保留文件: {keep_cloud_file}") # Delete the other duplicate files (if needed) for path in paths: @@ -280,8 +282,8 @@ class LibraryDuplicateCheck(_PluginBase): cloud_file_path = Path(duplicate_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}.*") + files = list(cloud_file_path.parent.glob(f"{pattern}.*")) + logger.info(f"筛选 {cloud_file_path.parent} 下同名文件 {pattern}.* {len(files)}个") media_files = [] for file in files: if Path(file).suffix.lower() in [ext.strip() for ext in