From 42fd8381b9750a19eed88548961f571a6187aa3a Mon Sep 17 00:00:00 2001 From: thsrite Date: Sun, 28 Apr 2024 13:07:52 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix=20mp=E6=9B=B4=E6=96=B0=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=85=BC=E5=AE=B9=E6=9B=B4=E6=96=B0=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=B8=A6=E7=89=88=E6=9C=AC=E5=8F=B7=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 +- plugins/moviepilotupdatenotify/__init__.py | 46 ++++++++++------------ 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index b0550ac..8642bdf 100644 --- a/package.json +++ b/package.json @@ -313,11 +313,12 @@ "MoviePilotUpdateNotify": { "name": "MoviePilot更新推送", "description": "MoviePilot推送release更新通知、自动重启。", - "version": "1.3", + "version": "1.4", "icon": "Moviepilot_A.png", "author": "thsrite", "level": 1, "history": { + "v1.4": "兼容更新内容带版本号的情况", "v1.3": "增加前端版本更新检查,需要主程序升级至v1.8.4+版本" } }, diff --git a/plugins/moviepilotupdatenotify/__init__.py b/plugins/moviepilotupdatenotify/__init__.py index e3df7f8..625af7a 100644 --- a/plugins/moviepilotupdatenotify/__init__.py +++ b/plugins/moviepilotupdatenotify/__init__.py @@ -22,7 +22,7 @@ class MoviePilotUpdateNotify(_PluginBase): # 插件图标 plugin_icon = "Moviepilot_A.png" # 插件版本 - plugin_version = "1.3" + plugin_version = "1.4" # 插件作者 plugin_author = "thsrite" # 作者主页 @@ -89,22 +89,10 @@ class MoviePilotUpdateNotify(_PluginBase): logger.info(f"发现MoviePilot后端更新:{release_version} {description} {update_time}") # 推送更新消息 - if self._notify: - # 将时间字符串转为datetime对象 - dt = datetime.datetime.strptime(update_time, "%Y-%m-%dT%H:%M:%SZ") - # 设置时区 - timezone = pytz.timezone(settings.TZ) - dt = dt.replace(tzinfo=timezone) - # 将datetime对象转换为带时区的字符串 - update_time = dt.strftime("%Y-%m-%d %H:%M:%S") - self.post_message( - mtype=NotificationType.SiteMessage, - title="【MoviePilot后端更新通知】", - text=f"{release_version} \n" - f"\n" - f"{description} \n" - f"\n" - f"{update_time}") + self.__notify_update(update_time=update_time, + release_version=release_version, + description=description, + mtype="后端") return True @@ -125,6 +113,18 @@ class MoviePilotUpdateNotify(_PluginBase): logger.info(f"发现MoviePilot前端更新:{release_version} {description} {update_time}") + # 推送更新消息 + self.__notify_update(update_time=update_time, + release_version=release_version, + description=description, + mtype="前端") + + return True + + def __notify_update(self, update_time, release_version, description, mtype): + """ + 推送更新消息 + """ # 推送更新消息 if self._notify: # 将时间字符串转为datetime对象 @@ -134,16 +134,12 @@ class MoviePilotUpdateNotify(_PluginBase): dt = dt.replace(tzinfo=timezone) # 将datetime对象转换为带时区的字符串 update_time = dt.strftime("%Y-%m-%d %H:%M:%S") + if not description.startswith(release_version): + description = f"{release_version}\n\n{description}" self.post_message( mtype=NotificationType.SiteMessage, - title="【MoviePilot前端更新通知】", - text=f"{release_version} \n" - f"\n" - f"{description} \n" - f"\n" - f"{update_time}") - - return True + title=f"【MoviePilot{mtype}更新通知】", + text=f"{description}\n\n{update_time}") @staticmethod def __get_release_version(): From 0851e94d1f65abcdb3162907a20acc23421b235a Mon Sep 17 00:00:00 2001 From: xuzhi Date: Sun, 28 Apr 2024 11:42:27 +0000 Subject: [PATCH 2/4] Update removelink to v2.0 --- package.json | 1 + plugins/removelink/__init__.py | 64 +++++++++++++++++++++++++++++----- 2 files changed, 57 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index d584a98..6cdfaf6 100644 --- a/package.json +++ b/package.json @@ -468,6 +468,7 @@ "author": "DzAvril", "level": 1, "history": { + "v2.0": "联动删除种子,需安装插件[下载器助手]并打开监听源文件事件", "v1.9": "增加清理刮削文件功能(beta)", "v1.8": "增加清理空目录功能(beta)", "v1.7": "修复因未监测重命名事件导致的清理硬链接失败的问题", diff --git a/plugins/removelink/__init__.py b/plugins/removelink/__init__.py index 32f1316..d3e4969 100644 --- a/plugins/removelink/__init__.py +++ b/plugins/removelink/__init__.py @@ -11,6 +11,8 @@ from watchdog.observers import Observer from app.log import logger from app.plugins import _PluginBase from app.schemas import NotificationType +from app.core.event import eventmanager +from app.schemas.types import EventType state_lock = threading.Lock() @@ -106,7 +108,7 @@ class RemoveLink(_PluginBase): # 插件图标 plugin_icon = "Ombi_A.png" # 插件版本 - plugin_version = "1.9" + plugin_version = "2.0" # 插件作者 plugin_author = "DzAvril" # 作者主页 @@ -125,6 +127,7 @@ class RemoveLink(_PluginBase): _enabled = False _notify = False _delete_scrap_infos = False + _delete_torrents = False _observer = [] # 监控目录的文件列表 state_set: Dict[str, int] = {} @@ -138,6 +141,7 @@ class RemoveLink(_PluginBase): self.exclude_dirs = config.get("exclude_dirs") or "" self.exclude_keywords = config.get("exclude_keywords") or "" self._delete_scrap_infos = config.get("delete_scrap_infos") + self._delete_torrents = config.get("delete_torrents") # 停止现有任务 self.stop_service() @@ -202,7 +206,7 @@ class RemoveLink(_PluginBase): "content": [ { "component": "VCol", - "props": {"cols": 12, "md": 4}, + "props": {"cols": 12, "md": 6}, "content": [ { "component": "VSwitch", @@ -215,7 +219,7 @@ class RemoveLink(_PluginBase): }, { "component": "VCol", - "props": {"cols": 12, "md": 4}, + "props": {"cols": 12, "md": 6}, "content": [ { "component": "VSwitch", @@ -226,9 +230,14 @@ class RemoveLink(_PluginBase): } ], }, + ], + }, + { + "component": "VRow", + "content": [ { "component": "VCol", - "props": {"cols": 12, "md": 4}, + "props": {"cols": 12, "md": 6}, "content": [ { "component": "VSwitch", @@ -239,6 +248,19 @@ class RemoveLink(_PluginBase): } ], }, + { + "component": "VCol", + "props": {"cols": 12, "md": 6}, + "content": [ + { + "component": "VSwitch", + "props": { + "model": "delete_torrents", + "label": "联动删除种子", + }, + } + ], + }, ], }, { @@ -317,7 +339,7 @@ class RemoveLink(_PluginBase): "props": { "type": "info", "variant": "tonal", - "text": "监控目录如有多个需换行,源目录和硬链接目录都需要添加到监控目录中;如需实现删除硬链接时不删除源文件,可把源文件目录配置到不删除目录中。", + "text": "联动删除种子需安装插件[下载器助手]并打开监听源文件事件", }, } ], @@ -338,6 +360,22 @@ class RemoveLink(_PluginBase): } ], }, + { + "component": "VCol", + "props": { + "cols": 12, + }, + "content": [ + { + "component": "VAlert", + "props": { + "type": "info", + "variant": "tonal", + "text": "监控目录如有多个需换行,源目录和硬链接目录都需要添加到监控目录中;如需实现删除硬链接时不删除源文件,可把源文件目录配置到不删除目录中。", + }, + } + ], + }, ], }, ], @@ -413,7 +451,7 @@ class RemoveLink(_PluginBase): for file in path.parent.iterdir(): if file.name.startswith(name_prefix): file.unlink() - logger.info(f'删除刮削文件:{file}') + logger.info(f"删除刮削文件:{file}") # 清理空目录 self.delete_empty_folders(path) @@ -438,7 +476,7 @@ class RemoveLink(_PluginBase): # 清除目录下所有文件 for file in parent_path.iterdir(): file.unlink() - logger.info(f'删除刮削文件:{file}') + logger.info(f"删除刮削文件:{file}") if not os.listdir(parent_path): os.rmdir(parent_path) @@ -462,6 +500,11 @@ class RemoveLink(_PluginBase): with state_lock: # 清理刮削文件 self.delete_scrap_infos(file_path) + if self._delete_torrents: + # 发送事件 + eventmanager.send_event( + EventType.DownloadFileDeleted, {"src": str(file_path)} + ) # 删除的文件inode deleted_inode = self.state_set.get(str(file_path)) if not deleted_inode: @@ -482,12 +525,17 @@ class RemoveLink(_PluginBase): file.unlink() # 清理刮削文件 self.delete_scrap_infos(file_path) + if self._delete_torrents: + # 发送事件 + eventmanager.send_event( + EventType.DownloadFileDeleted, {"src": str(file_path)} + ) if self._notify: self.post_message( mtype=NotificationType.SiteMessage, title=f"【清理硬链接】", text=f"监控到删除源文件:[{file_path}]\n" - f"同步删除硬链接文件:[{path}]", + f"同步删除硬链接文件:[{path}]", ) except Exception as e: logger.error( From ec17a156861fe9b937687498bbd5d6c27dad031e Mon Sep 17 00:00:00 2001 From: honue Date: Mon, 29 Apr 2024 14:59:25 +0800 Subject: [PATCH 3/4] fix #176 --- package.json | 3 ++- plugins/doubansync/__init__.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 6cdfaf6..1255aae 100644 --- a/package.json +++ b/package.json @@ -50,11 +50,12 @@ "name": "豆瓣想看", "description": "同步豆瓣想看数据,自动添加订阅。", "labels": "订阅", - "version": "1.7", + "version": "1.8", "icon": "douban.png", "author": "jxxghp", "level": 2, "history": { + "v1.8": "不同步在看条目", "v1.7": "增强API安全性", "v1.6": "同步历史记录支持手动删除,需要主程序升级至v1.8.4+版本", "v1.5": "豆瓣信息识别后直接添加订阅,不进行搜索下载" diff --git a/plugins/doubansync/__init__.py b/plugins/doubansync/__init__.py index bb00ddc..173367d 100644 --- a/plugins/doubansync/__init__.py +++ b/plugins/doubansync/__init__.py @@ -34,7 +34,7 @@ class DoubanSync(_PluginBase): # 插件图标 plugin_icon = "douban.png" # 插件版本 - plugin_version = "1.7" + plugin_version = "1.8" # 插件作者 plugin_author = "jxxghp" # 作者主页 @@ -520,8 +520,8 @@ class DoubanSync(_PluginBase): try: dtype = result.get("title", "")[:2] title = result.get("title", "")[2:] - if dtype not in ["想看", "在看"]: - logger.info(f'标题:{title},非想看/在看数据,跳过') + if dtype not in ["想看"]: + logger.info(f'标题:{title},非想看数据,跳过') continue if not result.get("link"): logger.warn(f'标题:{title},未获取到链接,跳过') From 6174cd7a36b11c035dd94ea85e286e551d6de9e1 Mon Sep 17 00:00:00 2001 From: honue Date: Mon, 29 Apr 2024 16:26:08 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=8D=E8=BE=85?= =?UTF-8?q?=E7=A7=8D=E5=B0=8F=E4=BD=93=E7=A7=AF=E7=A7=8D=E5=AD=90=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 +- plugins/iyuuautoseed/__init__.py | 47 +++++++++++++++++++++++++++++--- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 1255aae..30a9a5c 100644 --- a/package.json +++ b/package.json @@ -230,11 +230,12 @@ "name": "IYUU自动辅种", "description": "基于IYUU官方Api实现自动辅种。", "labels": "做种,IYUU", - "version": "1.5", + "version": "1.6", "icon": "IYUU.png", "author": "jxxghp", "level": 2, "history": { + "v1.6": "增加不辅种小体积种子功能", "v1.5": "支持馒头新架构辅种" } }, diff --git a/plugins/iyuuautoseed/__init__.py b/plugins/iyuuautoseed/__init__.py index d7d2afb..5e7e819 100644 --- a/plugins/iyuuautoseed/__init__.py +++ b/plugins/iyuuautoseed/__init__.py @@ -34,7 +34,7 @@ class IYUUAutoSeed(_PluginBase): # 插件图标 plugin_icon = "IYUU.png" # 插件版本 - plugin_version = "1.5" + plugin_version = "1.6" # 插件作者 plugin_author = "jxxghp" # 作者主页 @@ -64,6 +64,7 @@ class IYUUAutoSeed(_PluginBase): _notify = False _nolabels = None _nopaths = None + _size = None _clearcache = False # 退出事件 _event = Event() @@ -107,6 +108,7 @@ class IYUUAutoSeed(_PluginBase): self._notify = config.get("notify") self._nolabels = config.get("nolabels") self._nopaths = config.get("nopaths") + self._size = float(config.get("size")) if config.get("size") else 0 self._clearcache = config.get("clearcache") self._permanent_error_caches = [] if self._clearcache else config.get("permanent_error_caches") or [] self._error_caches = [] if self._clearcache else config.get("error_caches") or [] @@ -329,7 +331,23 @@ class IYUUAutoSeed(_PluginBase): { 'component': 'VCol', 'props': { - 'cols': 12 + 'cols': 6 + }, + 'content': [ + { + 'component': 'VTextField', + 'props': { + 'model': 'size', + 'label': '辅种体积大于(GB)', + 'placeholder': '只有大于该值的才辅种' + } + } + ] + }, + { + 'component': 'VCol', + 'props': { + 'cols': 6 }, 'content': [ { @@ -410,7 +428,8 @@ class IYUUAutoSeed(_PluginBase): "downloaders": [], "sites": [], "nopaths": "", - "nolabels": "" + "nolabels": "", + "size": "" } def get_page(self) -> List[dict]: @@ -428,6 +447,7 @@ class IYUUAutoSeed(_PluginBase): "notify": self._notify, "nolabels": self._nolabels, "nopaths": self._nopaths, + "size": self._size, "success_caches": self._success_caches, "error_caches": self._error_caches, "permanent_error_caches": self._permanent_error_caches @@ -504,6 +524,13 @@ class IYUUAutoSeed(_PluginBase): break if is_skip: continue + + # 体积排除辅种 + torrent_size = self.__get_torrent_size(torrent, downloader) / 1024 / 1024 / 1024 + if self._size and torrent_size < self._size: + logger.info(f"种子 {hash_str} 大小:{torrent_size:.2f}GB,小于设定 {self._size}GB,跳过 ...") + continue + hash_strs.append({ "hash": hash_str, "save_path": save_path @@ -887,6 +914,17 @@ class IYUUAutoSeed(_PluginBase): print(str(e)) return "" + @staticmethod + def __get_torrent_size(torrent: Any, dl_type: str): + """ + 获取种子大小 int bytes + """ + try: + return torrent.get("total_size") if dl_type == "qbittorrent" else torrent.total_size + except Exception as e: + print(str(e)) + return "" + def __get_download_url(self, seed: dict, site: CommentedMap, base_url: str): """ 拼装种子下载链接 @@ -972,7 +1010,8 @@ class IYUUAutoSeed(_PluginBase): flags=re.IGNORECASE) return f"{site.get('url')}{download_url}" except Exception as e: - logger.warn(f"{site.get('name')} Url转换失败,{str(e)}:site_url={site.get('url')},base_url={base_url}, seed={seed}") + logger.warn( + f"{site.get('name')} Url转换失败,{str(e)}:site_url={site.get('url')},base_url={base_url}, seed={seed}") return self.__get_torrent_url_from_page(seed=seed, site=site) def __get_torrent_url_from_page(self, seed: dict, site: dict):