From 172fb30b995daf655a9ed1ed4abb639d6b5b610b Mon Sep 17 00:00:00 2001 From: jxxghp Date: Wed, 28 Feb 2024 18:52:36 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat=EF=BC=9A=E6=B8=85=E7=90=86=E7=A1=AC?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=20=E6=94=AF=E6=8C=81=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=8D=E5=88=A0=E9=99=A4=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- plugins/removelink/__init__.py | 41 +++++++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index e2d10cf..6d0e9a7 100644 --- a/package.json +++ b/package.json @@ -346,7 +346,7 @@ "RemoveLink": { "name": "清理硬链接", "description": "监控目录内文件被删除时,同步删除监控目录内所有和它硬链接的文件", - "version": "1.4", + "version": "1.5", "icon": "Ombi_A.png", "author": "DzAvril", "level": 1 diff --git a/plugins/removelink/__init__.py b/plugins/removelink/__init__.py index 0b7a58a..4fb474d 100644 --- a/plugins/removelink/__init__.py +++ b/plugins/removelink/__init__.py @@ -85,7 +85,7 @@ class RemoveLink(_PluginBase): # 插件图标 plugin_icon = "Ombi_A.png" # 插件版本 - plugin_version = "1.4" + plugin_version = "1.5" # 插件作者 plugin_author = "DzAvril" # 作者主页 @@ -99,6 +99,7 @@ class RemoveLink(_PluginBase): # preivate property monitor_dirs = "" + exclude_dirs = "" exclude_keywords = ".!qB" _enabled = False _notify = False @@ -112,10 +113,12 @@ class RemoveLink(_PluginBase): self._enabled = config.get("enabled") self._notify = config.get("notify") self.monitor_dirs = config.get("monitor_dirs") + self.exclude_dirs = config.get("exclude_dirs") or "" self.exclude_keywords = config.get("exclude_keywords") or "" # 停止现有任务 self.stop_service() + if self._enabled: # 读取目录配置 monitor_dirs = self.monitor_dirs.split("\n") @@ -215,7 +218,27 @@ class RemoveLink(_PluginBase): "model": "monitor_dirs", "label": "监控目录", "rows": 5, - "placeholder": "每一行一个目录", + "placeholder": "源目录及硬链接目录均需加入监控,每一行一个目录", + }, + } + ], + } + ], + }, + { + "component": "VRow", + "content": [ + { + "component": "VCol", + "props": {"cols": 12}, + "content": [ + { + "component": "VTextarea", + "props": { + "model": "exclude_dirs", + "label": "不删除目录", + "rows": 5, + "placeholder": "该目录下的文件不会被动删除,一行一个目录", }, } ], @@ -258,7 +281,7 @@ class RemoveLink(_PluginBase): 'props': { 'type': 'info', 'variant': 'tonal', - 'text': '监控目录如有多个请换行,源目录和硬链接目录都需要添加到监控目录中。' + 'text': '监控目录如有多个需换行,源目录和硬链接目录都需要添加到监控目录中;如需实现删除硬链接时不删除源文件,可把源文件目录配置到不删除目录中。' } } ] @@ -292,6 +315,15 @@ class RemoveLink(_PluginBase): logger.error(f"停止目录监控失败:{str(e)}") self._observer = [] + def __is_excluded(self, file_path: Path) -> bool: + """ + 是否排除目录 + """ + for exclude_dir in self.exclude_dirs.split("\n"): + if exclude_dir and exclude_dir in str(file_path): + return True + return False + def handle_deleted(self, file_path: Path): """ 处理删除事件 @@ -310,6 +342,9 @@ class RemoveLink(_PluginBase): for path, inode in self.state_set.copy().items(): if inode == deleted_inode: file = Path(path) + if self.__is_excluded(file): + logger.info(f"文件 {file} 在不删除目录中,不处理") + continue # 删除硬链接文件 logger.info(f"删除硬链接文件:{path}, inode: {inode}") file.unlink() From ae9e82366273f21fdcded4d3825673ae48bac7cc Mon Sep 17 00:00:00 2001 From: EkkoG Date: Thu, 29 Feb 2024 21:49:39 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B1=86=E7=93=A3=20TOP?= =?UTF-8?q?=20250=20=E6=A6=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/doubanrank/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/doubanrank/__init__.py b/plugins/doubanrank/__init__.py index 401d257..949191d 100644 --- a/plugins/doubanrank/__init__.py +++ b/plugins/doubanrank/__init__.py @@ -53,6 +53,7 @@ class DoubanRank(_PluginBase): 'movie-hot-gaia': 'https://rsshub.app/douban/movie/weekly/movie_hot_gaia', 'tv-hot': 'https://rsshub.app/douban/movie/weekly/tv_hot', 'movie-top250': 'https://rsshub.app/douban/movie/weekly/movie_top250', + 'movie-top250-full': 'https://rsshub.app/douban/list/movie_top250', } _enabled = False _cron = "" @@ -274,6 +275,7 @@ class DoubanRank(_PluginBase): {'title': '热门电影', 'value': 'movie-hot-gaia'}, {'title': '热门电视剧', 'value': 'tv-hot'}, {'title': '电影TOP10', 'value': 'movie-top250'}, + {'title': '电影TOP250', 'value': 'movie-top250-full'}, ] } } From 7dc37a0abd81cd8d0bb1f373670c89dbadafe094 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Fri, 1 Mar 2024 09:43:06 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=5F=5Finit=5F=5F.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/doubanrank/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/doubanrank/__init__.py b/plugins/doubanrank/__init__.py index 949191d..9a4cae8 100644 --- a/plugins/doubanrank/__init__.py +++ b/plugins/doubanrank/__init__.py @@ -27,7 +27,7 @@ class DoubanRank(_PluginBase): # 插件图标 plugin_icon = "movie.jpg" # 插件版本 - plugin_version = "1.5" + plugin_version = "1.6" # 插件作者 plugin_author = "jxxghp" # 作者主页 From 27a9274e304c9ee54bc01976bbd5cb7e2b979beb Mon Sep 17 00:00:00 2001 From: jxxghp Date: Fri, 1 Mar 2024 09:43:33 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20package.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6d0e9a7..b722f18 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "DoubanRank": { "name": "豆瓣榜单订阅", "description": "监控豆瓣热门榜单,自动添加订阅。", - "version": "1.5", + "version": "1.6", "icon": "movie.jpg", "author": "jxxghp", "level": 2