From 2e8a1cfbab1b533cc169276e5c9cb0fa35e9a8cb Mon Sep 17 00:00:00 2001 From: thsrite Date: Fri, 25 Oct 2024 12:47:33 +0800 Subject: [PATCH] fix TorrentRemover v2 --- package.v2.json | 3 ++- plugins.v2/torrentremover/__init__.py | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/package.v2.json b/package.v2.json index f311cd1..d1ded01 100644 --- a/package.v2.json +++ b/package.v2.json @@ -197,11 +197,12 @@ "name": "自动删种", "description": "自动删除下载器中的下载任务。", "labels": "做种", - "version": "2.0", + "version": "2.1", "icon": "delete.jpg", "author": "jxxghp", "level": 2, "history": { + "v2.1": "修复兼容MoviePilot V2 版本", "v2.0": "兼容MoviePilot V2 版本" } }, diff --git a/plugins.v2/torrentremover/__init__.py b/plugins.v2/torrentremover/__init__.py index 8a87421..6aa67ee 100644 --- a/plugins.v2/torrentremover/__init__.py +++ b/plugins.v2/torrentremover/__init__.py @@ -26,7 +26,7 @@ class TorrentRemover(_PluginBase): # 插件图标 plugin_icon = "delete.jpg" # 插件版本 - plugin_version = "2.0" + plugin_version = "2.1" # 插件作者 plugin_author = "jxxghp" # 作者主页 @@ -617,6 +617,12 @@ class TorrentRemover(_PluginBase): """ return self.service_infos.get(name).instance + def __get_downloader_config(self, name: str): + """ + 根据类型返回下载器实例配置 + """ + return self.service_infos.get(name).config + def delete_torrents(self): """ 定时删除下载器中的下载任务 @@ -779,6 +785,7 @@ class TorrentRemover(_PluginBase): remove_torrents = [] # 下载器对象 downloader_obj = self.__get_downloader(downloader) + downloader_config = self.__get_downloader_config(downloader) # 标题 if self._labels: tags = self._labels.split(',') @@ -792,7 +799,7 @@ class TorrentRemover(_PluginBase): return [] # 处理种子 for torrent in torrents: - if downloader == "qbittorrent": + if downloader_config.type == "qbittorrent": item = self.__get_qb_torrent(torrent) else: item = self.__get_tr_torrent(torrent)