fix TorrentRemover v2

This commit is contained in:
thsrite
2024-10-25 12:47:33 +08:00
parent 4502f73dad
commit 2e8a1cfbab
2 changed files with 11 additions and 3 deletions

View File

@@ -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 版本"
}
},

View File

@@ -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)