diff --git a/package.json b/package.json index 7da0d81..4961fef 100644 --- a/package.json +++ b/package.json @@ -346,7 +346,7 @@ "RemoveLink": { "name": "清理硬链接", "description": "监控目录内文件被删除时,同步删除监控目录内所有和它硬链接的文件", - "version": "1.5", + "version": "1.6", "icon": "Ombi_A.png", "author": "DzAvril", "level": 1 diff --git a/plugins/removelink/__init__.py b/plugins/removelink/__init__.py index 799c3c0..a8aedf7 100644 --- a/plugins/removelink/__init__.py +++ b/plugins/removelink/__init__.py @@ -28,8 +28,10 @@ class FileMonitorHandler(FileSystemEventHandler): def on_created(self, event): if event.is_directory: return - logger.info("监测到新增文件:%s" % event.src_path) file_path = Path(event.src_path) + if file_path.suffix in [".!qB", ".part", ".mp"]: + return + logger.info(f"监测到新增文件:{file_path}") if self.sync.exclude_keywords: for keyword in self.sync.exclude_keywords.split("\n"): if keyword and keyword in str(file_path): @@ -42,8 +44,10 @@ class FileMonitorHandler(FileSystemEventHandler): def on_deleted(self, event): if event.is_directory: return - logger.info("监测到删除文件:%s" % event.src_path) file_path = Path(event.src_path) + if file_path.suffix in [".!qB", ".part", ".mp"]: + return + logger.info(f"监测到删除文件:{file_path}") # 命中过滤关键字不处理 if self.sync.exclude_keywords: for keyword in self.sync.exclude_keywords.split("\n"): @@ -58,7 +62,8 @@ def updateState(monitor_dirs: List[str]): """ 更新监控目录的文件列表 """ - start_time = time.time() # 记录开始时间 + # 记录开始时间 + start_time = time.time() state_set = {} for mon_path in monitor_dirs: for root, dirs, files in os.walk(mon_path): @@ -85,7 +90,7 @@ class RemoveLink(_PluginBase): # 插件图标 plugin_icon = "Ombi_A.png" # 插件版本 - plugin_version = "1.5" + plugin_version = "1.6" # 插件作者 plugin_author = "DzAvril" # 作者主页 @@ -100,7 +105,7 @@ class RemoveLink(_PluginBase): # preivate property monitor_dirs = "" exclude_dirs = "" - exclude_keywords = ".!qB" + exclude_keywords = "" _enabled = False _notify = False _observer = [] @@ -295,7 +300,7 @@ class RemoveLink(_PluginBase): "notify": False, "onlyonce": False, "monitor_dirs": "", - "exclude_keywords": ".!qB", + "exclude_keywords": "", } def get_page(self) -> List[dict]: