feat:下载器支持多选
This commit is contained in:
parent
15bdb694cc
commit
8b4495c857
@ -292,7 +292,7 @@ class DownloadChain(ChainBase):
|
||||
continue
|
||||
files_to_add.append({
|
||||
"download_hash": _hash,
|
||||
"downloader": settings.DOWNLOADER,
|
||||
"downloader": settings.DEFAULT_DOWNLOADER,
|
||||
"fullpath": str(download_dir / _folder_name / file),
|
||||
"savepath": str(download_dir / _folder_name),
|
||||
"filepath": file,
|
||||
|
@ -125,7 +125,7 @@ class Settings(BaseSettings):
|
||||
VOCECHAT_API_KEY: str = ""
|
||||
# VoceChat 频道ID
|
||||
VOCECHAT_CHANNEL_ID: str = ""
|
||||
# 下载器 qbittorrent/transmission
|
||||
# 下载器 qbittorrent/transmission,启用多个下载器时使用,分隔,只有第一个会被默认使用
|
||||
DOWNLOADER: str = "qbittorrent"
|
||||
# 下载器监控开关
|
||||
DOWNLOADER_MONITOR: bool = True
|
||||
@ -362,6 +362,24 @@ class Settings(BaseSettings):
|
||||
}
|
||||
return {}
|
||||
|
||||
@property
|
||||
def DEFAULT_DOWNLOADER(self):
|
||||
"""
|
||||
默认下载器
|
||||
"""
|
||||
if not self.DOWNLOADER:
|
||||
return None
|
||||
return self.DOWNLOADER.split(",")[0]
|
||||
|
||||
@property
|
||||
def DOWNLOADERS(self):
|
||||
"""
|
||||
下载器列表
|
||||
"""
|
||||
if not self.DOWNLOADER:
|
||||
return []
|
||||
return self.DOWNLOADER.split(",")
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
with self.CONFIG_PATH as p:
|
||||
|
@ -73,8 +73,12 @@ class QbittorrentModule(_ModuleBase):
|
||||
logger.error(f"获取种子名称失败:{e}")
|
||||
return "", 0
|
||||
|
||||
# 不是默认下载器不处理
|
||||
if settings.DEFAULT_DOWNLOADER != "qbittorrent":
|
||||
return None
|
||||
|
||||
if not content:
|
||||
return
|
||||
return None
|
||||
if isinstance(content, Path) and not content.exists():
|
||||
return None, f"种子文件不存在:{content}"
|
||||
|
||||
|
@ -73,8 +73,12 @@ class TransmissionModule(_ModuleBase):
|
||||
logger.error(f"获取种子名称失败:{e}")
|
||||
return "", 0
|
||||
|
||||
# 不是默认下载器不处理
|
||||
if settings.DEFAULT_DOWNLOADER != "transmission":
|
||||
return None
|
||||
|
||||
if not content:
|
||||
return
|
||||
return None
|
||||
if isinstance(content, Path) and not content.exists():
|
||||
return None, f"种子文件不存在:{content}"
|
||||
|
||||
|
@ -290,6 +290,8 @@ class Scheduler(metaclass=Singleton):
|
||||
"""
|
||||
更新插件定时服务
|
||||
"""
|
||||
if not self._scheduler:
|
||||
return
|
||||
# 移除该插件的全部服务
|
||||
self.remove_plugin_job(pid)
|
||||
# 获取插件服务列表
|
||||
@ -332,6 +334,8 @@ class Scheduler(metaclass=Singleton):
|
||||
"""
|
||||
移除插件定时服务
|
||||
"""
|
||||
if not self._scheduler:
|
||||
return
|
||||
with self._lock:
|
||||
# 获取插件名称
|
||||
plugin_name = PluginManager().get_plugin_attr(pid, "plugin_name")
|
||||
@ -351,6 +355,8 @@ class Scheduler(metaclass=Singleton):
|
||||
"""
|
||||
当前所有任务
|
||||
"""
|
||||
if not self._scheduler:
|
||||
return []
|
||||
with self._lock:
|
||||
# 返回计时任务
|
||||
schedulers = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user