From 37cc2fa11dbd18e74714dc8f8379517020f34169 Mon Sep 17 00:00:00 2001 From: thsrite Date: Sun, 2 Jun 2024 11:08:57 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E7=9B=AE=E5=BD=95=E7=9B=91=E6=8E=A7?= =?UTF-8?q?=E7=89=B9=E6=AE=8A=E5=9C=BA=E6=99=AF=E8=A1=A5=E5=85=85=E8=BD=AC?= =?UTF-8?q?=E7=A7=BB=E6=88=90=E5=8A=9F=E5=8E=86=E5=8F=B2=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 ++- plugins/dirmonitor/__init__.py | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index be88534..42a2cdb 100644 --- a/package.json +++ b/package.json @@ -75,11 +75,12 @@ "name": "目录监控", "description": "监控目录文件发生变化时实时整理到媒体库。", "labels": "文件整理", - "version": "2.2", + "version": "2.3", "icon": "directory.png", "author": "jxxghp", "level": 1, "history": { + "v2.3": "特殊场景下补充转移成功历史记录", "v2.2": "更新目录设置说明", "v2.1": "增加了元数据刮削开关,升级后需要手动打开,否则默认不刮削", "v2.0": "增强API安全性", diff --git a/plugins/dirmonitor/__init__.py b/plugins/dirmonitor/__init__.py index 82cb002..f6623e6 100644 --- a/plugins/dirmonitor/__init__.py +++ b/plugins/dirmonitor/__init__.py @@ -59,7 +59,7 @@ class DirMonitor(_PluginBase): # 插件图标 plugin_icon = "directory.png" # 插件版本 - plugin_version = "2.2" + plugin_version = "2.3" # 插件作者 plugin_author = "jxxghp" # 作者主页 @@ -174,7 +174,8 @@ class DirMonitor(_PluginBase): try: if target_path and target_path.is_relative_to(Path(mon_path)): logger.warn(f"{target_path} 是监控目录 {mon_path} 的子目录,无法监控") - self.systemmessage.put(f"{target_path} 是下载目录 {mon_path} 的子目录,无法监控", title="目录监控") + self.systemmessage.put(f"{target_path} 是下载目录 {mon_path} 的子目录,无法监控", + title="目录监控") continue except Exception as e: logger.debug(str(e)) @@ -429,6 +430,20 @@ class DirMonitor(_PluginBase): return if not transferinfo.success: + # 判断是否转移后文件已存在,补充转移成功历史记录 + if transferinfo.target_path and transferinfo.target_path.exists(): + logger.info(f"{file_path.name} 目标文件已存在,补充转移成功历史记录") + # 补充转移成功历史记录 + self.transferhis.add_success( + src_path=file_path, + mode=transfer_type, + download_hash=download_hash, + meta=file_meta, + mediainfo=mediainfo, + transferinfo=transferinfo + ) + return + # 转移失败 logger.warn(f"{file_path.name} 入库失败:{transferinfo.message}") # 新增转移失败历史记录