diff --git a/package.json b/package.json index c79b1ef..30a9a5c 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "AutoSignIn": { "name": "站点自动签到", "description": "自动模拟登录、签到站点。", + "labels": "站点", "version": "2.1", "icon": "signin.png", "author": "thsrite", @@ -15,6 +16,7 @@ "CustomSites": { "name": "自定义站点", "description": "增加自定义站点为签到和统计使用。", + "labels": "站点", "version": "1.0", "icon": "world.png", "author": "lightolly", @@ -23,6 +25,7 @@ "SiteStatistic": { "name": "站点数据统计", "description": "自动统计和展示站点数据。", + "labels": "站点", "version": "2.9", "icon": "statistic.png", "author": "lightolly", @@ -37,6 +40,7 @@ "SiteRefresh": { "name": "站点自动更新", "description": "使用浏览器模拟登录站点获取Cookie和UA。", + "labels": "站点", "version": "1.2", "icon": "Chrome_A.png", "author": "thsrite", @@ -45,11 +49,13 @@ "DoubanSync": { "name": "豆瓣想看", "description": "同步豆瓣想看数据,自动添加订阅。", - "version": "1.7", + "labels": "订阅", + "version": "1.8", "icon": "douban.png", "author": "jxxghp", "level": 2, "history": { + "v1.8": "不同步在看条目", "v1.7": "增强API安全性", "v1.6": "同步历史记录支持手动删除,需要主程序升级至v1.8.4+版本", "v1.5": "豆瓣信息识别后直接添加订阅,不进行搜索下载" @@ -58,6 +64,7 @@ "DirMonitor": { "name": "目录监控", "description": "监控目录文件发生变化时实时整理到媒体库。", + "labels": "文件整理", "version": "2.0", "icon": "directory.png", "author": "jxxghp", @@ -70,6 +77,7 @@ "ChineseSubFinder": { "name": "ChineseSubFinder", "description": "整理入库时通知ChineseSubFinder下载字幕。", + "labels": "字幕", "version": "1.1", "icon": "chinesesubfinder.png", "author": "jxxghp", @@ -78,6 +86,7 @@ "DoubanRank": { "name": "豆瓣榜单订阅", "description": "监控豆瓣热门榜单,自动添加订阅。", + "labels": "订阅", "version": "1.9", "icon": "movie.jpg", "author": "jxxghp", @@ -90,6 +99,7 @@ "LibraryScraper": { "name": "媒体库刮削", "description": "定时对媒体库进行刮削,补齐缺失元数据和图片。", + "labels": "刮削", "version": "1.4", "icon": "scraper.png", "author": "jxxghp", @@ -98,6 +108,7 @@ "TorrentRemover": { "name": "自动删种", "description": "自动删除下载器中的下载任务。", + "labels": "做种", "version": "1.2.2", "icon": "delete.jpg", "author": "jxxghp", @@ -106,6 +117,7 @@ "MediaSyncDel": { "name": "媒体文件同步删除", "description": "同步删除历史记录、源文件和下载任务。", + "labels": "文件整理", "version": "1.4", "icon": "mediasyncdel.png", "author": "thsrite", @@ -114,6 +126,7 @@ "CustomHosts": { "name": "自定义Hosts", "description": "修改系统hosts文件,加速网络访问。", + "labels": "网络", "version": "1.0", "icon": "hosts.png", "author": "thsrite", @@ -122,6 +135,7 @@ "SpeedLimiter": { "name": "播放限速", "description": "外网播放媒体库视频时,自动对下载器进行限速。", + "labels": "网络", "version": "1.1", "icon": "Librespeed_A.png", "author": "Shurelol", @@ -130,6 +144,7 @@ "CloudflareSpeedTest": { "name": "Cloudflare IP优选", "description": "🌩 测试 Cloudflare CDN 延迟和速度,自动优选IP。", + "labels": "网络,站点", "version": "1.2", "icon": "cloudflare.jpg", "author": "thsrite", @@ -141,6 +156,7 @@ "BestFilmVersion": { "name": "收藏洗版", "description": "Jellyfin/Emby/Plex点击收藏电影后,自动订阅洗版。", + "labels": "订阅", "version": "2.1", "icon": "like.jpg", "author": "wlj", @@ -149,6 +165,7 @@ "MediaServerMsg": { "name": "媒体库服务器通知", "description": "发送Emby/Jellyfin/Plex服务器的播放、入库等通知消息。", + "labels": "消息通知,媒体库", "version": "1.1", "icon": "mediaplay.png", "author": "jxxghp", @@ -157,6 +174,7 @@ "MediaServerRefresh": { "name": "媒体库服务器刷新", "description": "入库后自动刷新Emby/Jellyfin/Plex服务器海报墙。", + "labels": "媒体库", "version": "1.2", "icon": "refresh2.png", "author": "jxxghp", @@ -173,6 +191,7 @@ "ChatGPT": { "name": "ChatGPT", "description": "消息交互支持与ChatGPT对话。", + "labels": "消息通知,识别", "version": "1.3", "icon": "Chatgpt_A.png", "author": "jxxghp", @@ -189,6 +208,7 @@ "MessageForward": { "name": "消息转发", "description": "根据正则转发通知到其他WeChat应用。", + "labels": "消息通知", "version": "1.1", "icon": "forward.png", "author": "thsrite", @@ -197,6 +217,7 @@ "AutoBackup": { "name": "自动备份", "description": "自动备份数据和配置文件。", + "labels": "系统设置", "version": "1.2", "icon": "Time_machine_B.png", "author": "thsrite", @@ -208,17 +229,20 @@ "IYUUAutoSeed": { "name": "IYUU自动辅种", "description": "基于IYUU官方Api实现自动辅种。", - "version": "1.5", + "labels": "做种,IYUU", + "version": "1.6", "icon": "IYUU.png", "author": "jxxghp", "level": 2, "history": { + "v1.6": "增加不辅种小体积种子功能", "v1.5": "支持馒头新架构辅种" } }, "CrossSeed": { "name": "青蛙辅种助手", "description": "参考ReseedPuppy和IYUU辅种插件实现自动辅种,支持站点:青蛙、AGSVPT、麒麟、UBits、聆音、憨憨等。", + "labels": "做种", "version": "2.3", "icon": "qingwa.png", "author": "233@qingwa", @@ -231,6 +255,7 @@ "VCBAnimeMonitor": { "name": "整理VCB动漫压制组作品", "description": "提高部分VCB-Studio作品的识别准确率,将VCB-Studio的作品统一转移到指定目录同时进行刮削整理", + "labels": "文件整理,识别", "version": "1.7", "icon": "vcbmonitor.png", "author": "pixel@qingwa", @@ -239,6 +264,7 @@ "TorrentTransfer": { "name": "自动转移做种", "description": "定期转移下载器中的做种任务到另一个下载器。", + "labels": "做种", "version": "1.3", "icon": "seed.png", "author": "jxxghp", @@ -247,6 +273,7 @@ "RssSubscribe": { "name": "自定义订阅", "description": "定时刷新RSS报文,识别内容后添加订阅或直接下载。", + "labels": "订阅", "version": "1.3", "icon": "rss.png", "author": "jxxghp", @@ -258,6 +285,7 @@ "SyncDownloadFiles": { "name": "下载器文件同步", "description": "同步下载器的文件信息到数据库,删除文件时联动删除下载任务。", + "labels": "下载管理", "version": "1.1", "icon": "Youtube-dl_A.png", "author": "thsrite", @@ -266,6 +294,7 @@ "BrushFlow": { "name": "站点刷流", "description": "自动托管刷流,将会提高对应站点的访问频率。", + "labels": "刷流", "version": "2.9", "icon": "brush.jpg", "author": "jxxghp,InfinityPacer", @@ -281,6 +310,7 @@ "DownloadingMsg": { "name": "下载进度推送", "description": "定时推送正在下载进度。", + "labels": "消息通知,下载管理", "version": "1.1", "icon": "downloadmsg.png", "author": "thsrite", @@ -289,6 +319,7 @@ "AutoClean": { "name": "定时清理媒体库", "description": "定时清理用户下载的种子、源文件、媒体库文件。", + "labels": "媒体库", "version": "1.1", "icon": "clean.png", "author": "thsrite", @@ -297,6 +328,7 @@ "InvitesSignin": { "name": "药丸签到", "description": "药丸论坛签到。", + "labels": "站点", "version": "1.4", "icon": "invites.png", "author": "thsrite", @@ -308,6 +340,7 @@ "PersonMeta": { "name": "演职人员刮削", "description": "刮削演职人员图片以及中文名称。", + "labels": "媒体库,刮削", "version": "1.2", "icon": "actor.png", "author": "jxxghp", @@ -316,17 +349,20 @@ "MoviePilotUpdateNotify": { "name": "MoviePilot更新推送", "description": "MoviePilot推送release更新通知、自动重启。", - "version": "1.3", + "labels": "消息通知,自动更新", + "version": "1.4", "icon": "Moviepilot_A.png", "author": "thsrite", "level": 1, "history": { + "v1.4": "兼容更新内容带版本号的情况", "v1.3": "增加前端版本更新检查,需要主程序升级至v1.8.4+版本" } }, "CloudDiskDel": { "name": "云盘文件删除", "description": "媒体库删除strm文件后同步删除云盘资源。", + "labels": "媒体库", "version": "1.3", "icon": "clouddisk.png", "author": "thsrite", @@ -335,6 +371,7 @@ "BarkMsg": { "name": "Bark消息推送", "description": "支持使用Bark发送消息通知。", + "labels": "消息通知", "version": "1.1", "icon": "Bark_A.png", "author": "jxxghp", @@ -343,6 +380,7 @@ "IyuuMsg": { "name": "IYUU消息推送", "description": "支持使用IYUU发送消息通知。", + "labels": "消息通知,IYUU", "version": "1.2", "icon": "Iyuu_A.png", "author": "jxxghp", @@ -351,6 +389,7 @@ "PushDeerMsg": { "name": "PushDeer消息推送", "description": "支持使用PushDeer发送消息通知。", + "labels": "消息通知", "version": "1.1", "icon": "pushdeer.png", "author": "jxxghp", @@ -359,6 +398,7 @@ "ConfigCenter": { "name": "配置中心", "description": "快速调整部分系统设定。", + "labels": "系统设置", "version": "2.4", "icon": "setting.png", "author": "jxxghp", @@ -367,6 +407,7 @@ "WorkWechatMsg": { "name": "企微机器人消息推送", "description": "支持使用企业微信群聊机器人发送消息通知。", + "labels": "消息通知", "version": "1.0", "icon": "Wecom_A.png", "author": "叮叮当", @@ -375,6 +416,7 @@ "EpisodeGroupMeta": { "name": "TMDB剧集组刮削", "description": "从TMDB剧集组刮削季集的实际顺序。", + "labels": "刮削", "version": "1.1", "icon": "Element_A.png", "author": "叮叮当", @@ -383,6 +425,7 @@ "CustomIndexer": { "name": "自定义索引站点", "description": "修改或扩展内建索引器支持的站点。", + "labels": "站点", "version": "1.0", "icon": "spider.png", "author": "jxxghp", @@ -391,6 +434,7 @@ "FFmpegThumb": { "name": "FFmpeg缩略图", "description": "TheMovieDb没有背景图片时使用FFmpeg截取视频文件缩略图", + "labels": "刮削", "version": "1.2", "icon": "ffmpeg.png", "author": "jxxghp", @@ -399,6 +443,7 @@ "PushPlusMsg": { "name": "PushPlus消息推送", "description": "支持使用PushPlus发送消息通知。", + "labels": "消息通知", "version": "1.0", "icon": "Pushplus_A.png", "author": "cheng", @@ -407,6 +452,7 @@ "DownloadSiteTag": { "name": "下载任务分类与标签", "description": "自动给下载任务分类与打站点标签、剧集名称标签", + "labels": "下载管理", "version": "2.1", "icon": "Youtube-dl_B.png", "author": "叮叮当", @@ -418,11 +464,13 @@ "RemoveLink": { "name": "清理硬链接", "description": "监控目录内文件被删除时,同步删除监控目录内所有和它硬链接的文件", + "labels": "文件整理", "version": "1.9", "icon": "Ombi_A.png", "author": "DzAvril", "level": 1, "history": { + "v2.0": "联动删除种子,需安装插件[下载器助手]并打开监听源文件事件", "v1.9": "增加清理刮削文件功能(beta)", "v1.8": "增加清理空目录功能(beta)", "v1.7": "修复因未监测重命名事件导致的清理硬链接失败的问题", @@ -432,6 +480,7 @@ "LinkMonitor": { "name": "实时硬链接", "description": "监控目录文件变化,实时硬链接。", + "labels": "文件整理", "version": "1.6", "icon": "Linkace_C.png", "author": "jxxghp", @@ -443,6 +492,7 @@ "CategoryEditor": { "name": "二级分类策略", "description": "编辑下载目录和媒体库目录的二级分类规则。", + "labels": "文件整理", "version": "1.1", "icon": "Bookstack_A.png", "author": "jxxghp", @@ -451,6 +501,7 @@ "RemoteIdentifiers": { "name": "共享识别词", "description": "从Github、Etherpad等远程文件中获取共享识别词并应用。", + "labels": "识别", "version": "2.2", "icon": "words.png", "author": "honue", @@ -459,6 +510,7 @@ "NeoDBSync": { "name": "NeoDB 想看", "description": "同步 NeoDB 想看条目,自动添加订阅。", + "labels": "订阅", "version": "1.1", "icon": "NeoDB.jpeg", "author": "hcplantern", @@ -470,6 +522,7 @@ "PlayletCategory": { "name": "短剧自动分类", "description": "网络短剧自动整理到独立的分类目录。", + "labels": "文件整理", "version": "1.4", "icon": "Amule_A.png", "author": "jxxghp", @@ -478,6 +531,7 @@ "DiagParamAdjust": { "name": "诊断参数调整", "description": "Emby专用插件|暂时性解决emby字幕偏移问题,需要emby安装Diagnostics插件。", + "labels": "Emby", "version": "1.3", "icon": "Gatus_A.png", "author": "jeblove", @@ -486,6 +540,7 @@ "QbCommand": { "name": "QB远程操作", "description": "通过定时任务或交互命令远程操作QB暂停/开始/限速等。", + "labels": "下载管理,Qbittorrent", "version": "1.4", "icon": "Qbittorrent_A.png", "author": "DzAvril", @@ -497,6 +552,7 @@ "TrCommand": { "name": "TR远程操作", "description": "通过定时任务或交互命令远程操作TR暂停/开始/限速等。", + "labels": "下载管理,Transmission", "version": "1.1", "icon": "Transmission_A.png", "author": "Hoey", @@ -505,6 +561,7 @@ "IpDetect": { "name": "本地IP检测", "description": "如果QB、TR等服务在本地部署,当本地IP改变时自动修改其Server IP。", + "labels": "系统设置", "version": "1.1", "icon": "ipAddress.png", "author": "DzAvril", @@ -513,6 +570,7 @@ "TrackerEditor": { "name": "Tracker替换", "description": "批量替换种子tracker,支持周期性巡检(如为TR,仅支持4.0以上版本)。", + "labels": "做种", "version": "1.5", "icon": "trackereditor_A.png", "author": "honue", @@ -521,6 +579,7 @@ "ContractCheck": { "name": "契约检查", "description": "定时检查保种契约达成情况。", + "labels": "做种", "version": "1.1", "icon": "contract.png", "author": "DzAvril", @@ -529,6 +588,7 @@ "DownloaderHelper": { "name": "下载器助手", "description": "自动做种、站点标签、自动删种。", + "labels": "下载管理", "version": "1.6", "icon": "DownloaderHelper.png", "author": "hotlcc", @@ -540,6 +600,7 @@ "FeiShuMsg": { "name": "飞书机器人消息通知", "description": "支持使用飞书群聊机器人发送消息通知。", + "labels": "消息通知", "version": "1.0", "icon": "FeiShu_A.png", "author": "InfinityPacer", @@ -548,6 +609,7 @@ "IyuuAuth": { "name": "IYUU站点绑定", "description": "为IYUU账号绑定认证站点,以便用于用户认证和辅种。", + "labels": "IYUU", "version": "1.1", "icon": "Iyuu_A.png", "author": "jxxghp", @@ -559,6 +621,7 @@ "NtfyMsg": { "name": "ntfy消息推送", "description": "支持使用ntfy发送消息通知。", + "labels": "消息通知", "version": "1.0", "icon": "Ntfy_A.png", "author": "lethargicScribe", @@ -567,6 +630,7 @@ "PluginAutoUpgrade": { "name": "插件自动升级", "description": "定时检测、升级插件。", + "labels": "自动更新", "version": "1.4", "icon": "PluginAutoUpgrade.png", "author": "hotlcc", @@ -575,6 +639,7 @@ "MergeSiteSwitch": { "name": "聚合站点开关", "description": "统一管理所有与站点相关的开关。", + "labels": "系统设置", "version": "1.0", "icon": "world.png", "author": "hotlcc", 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},未获取到链接,跳过') 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): 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(): 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(