Merge pull request #347 from DzAvril/main

This commit is contained in:
jxxghp
2024-05-31 18:36:14 +08:00
committed by GitHub
2 changed files with 28 additions and 3 deletions

View File

@@ -743,11 +743,12 @@
"name": "清理QB无效做种",
"description": "清理已经被站点删除的种子及对应源文件仅支持QB",
"labels": "Qbittorrent",
"version": "1.8",
"version": "1.9",
"icon": "clean_a.png",
"author": "DzAvril",
"level": 1,
"history": {
"v1.9": "增加自定义需删除做种的tracker的错误信息",
"v1.8": "增加远程命令切换全量通知修复bug",
"v1.7": "修复因消息内容包含'_'导致telegram API调用失败的问题",
"v1.6": "修复当种子有多个标签时,通过标签过滤不删除种子会失效的问题",

View File

@@ -28,7 +28,7 @@ class CleanInvalidSeed(_PluginBase):
# 插件图标
plugin_icon = "clean_a.png"
# 插件版本
plugin_version = "1.8"
plugin_version = "1.9"
# 插件作者
plugin_author = "DzAvril"
# 作者主页
@@ -61,6 +61,7 @@ class CleanInvalidSeed(_PluginBase):
"Torrent not registered with this tracker",
"torrent banned",
]
_custom_error_msg = ""
def init_plugin(self, config: dict = None):
# 停止现有任务
@@ -79,6 +80,7 @@ class CleanInvalidSeed(_PluginBase):
self._exclude_keywords = config.get("exclude_keywords")
self._exclude_categories = config.get("exclude_categories")
self._exclude_labels = config.get("exclude_labels")
self._custom_error_msg = config.get("custom_error_msg")
self._qb = Qbittorrent()
# 加载模块
@@ -119,6 +121,7 @@ class CleanInvalidSeed(_PluginBase):
"exclude_keywords": self._exclude_keywords,
"exclude_categories": self._exclude_categories,
"exclude_labels": self._exclude_labels,
"custom_error_msg": self._custom_error_msg,
}
)
@@ -284,6 +287,7 @@ class CleanInvalidSeed(_PluginBase):
working_tracker_set = set()
exclude_categories = self._exclude_categories.split("\n") if self._exclude_categories else []
exclude_labels = self._exclude_labels.split("\n") if self._exclude_labels else []
error_msgs = self._error_msg + self._custom_error_msg.split("\n") if self._exclude_labels else []
# 第一轮筛选出所有未工作的种子
for torrent in all_torrents:
trackers = torrent.trackers
@@ -299,7 +303,7 @@ class CleanInvalidSeed(_PluginBase):
if not (
(tracker.get("status") == 4)
and (tracker.get("msg") in self._error_msg)
and (tracker.get("msg") in error_msgs)
):
is_invalid = False
working_tracker_set.add(tracker_domian)
@@ -728,6 +732,26 @@ class CleanInvalidSeed(_PluginBase):
},
],
},
{
"component": "VRow",
"content": [
{
"component": "VCol",
"props": {"cols": 12},
"content": [
{
"component": "VTextarea",
"props": {
"model": "custom_error_msg",
"label": "自定义无效做种tracker错误信息",
"rows": 5,
"placeholder": "填入想要清理的种子的tracker错误信息'skipping tracker announce (unreachable) ',多个信息请换行",
},
}
],
}
],
},
{
"component": "VRow",
"content": [