From d03771f8abc2f0f2dc3b268cc98512a209962c6a Mon Sep 17 00:00:00 2001 From: WithdewHua Date: Sat, 28 Oct 2023 15:03:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20qb=20=E6=94=AF=E6=8C=81=E5=BC=BA?= =?UTF-8?q?=E5=88=B6=E7=BB=A7=E7=BB=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + app/core/config.py | 2 ++ app/modules/qbittorrent/__init__.py | 8 +++++++- config/app.env | 2 ++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 32f47f9e..3008b1da 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,7 @@ MoviePilot需要配套下载器和媒体服务器配合使用。 - **QB_PASSWORD:** qbittorrent密码 - **QB_CATEGORY:** qbittorrent分类自动管理,`true`/`false`,默认`false`,开启后会将下载二级分类传递到下载器,由下载器管理下载目录,需要同步开启`DOWNLOAD_CATEGORY` - **QB_SEQUENTIAL:** qbittorrent按顺序下载,`true`/`false`,默认`true` + - **QB_FORCE_RESUME:** qbittorrent忽略队列限制,强制继续,`true`/`false`,默认 `false` - `transmission`设置项: diff --git a/app/core/config.py b/app/core/config.py index 6131e626..c4e99b96 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -131,6 +131,8 @@ class Settings(BaseSettings): QB_CATEGORY: bool = False # Qbittorrent按顺序下载 QB_SEQUENTIAL: bool = True + # Qbittorrent忽略队列限制,强制继续 + QB_FORCE_RESUME: bool = False # Transmission地址,IP:PORT TR_HOST: str = None # Transmission用户名 diff --git a/app/modules/qbittorrent/__init__.py b/app/modules/qbittorrent/__init__.py index 4d370d97..922e09d2 100644 --- a/app/modules/qbittorrent/__init__.py +++ b/app/modules/qbittorrent/__init__.py @@ -101,9 +101,15 @@ class QbittorrentModule(_ModuleBase): # 选择文件 self.qbittorrent.set_files(torrent_hash=torrent_hash, file_ids=file_ids, priority=0) # 开始任务 - self.qbittorrent.start_torrents(torrent_hash) + if settings.QB_FORCE_RESUME: + # 强制继续 + self.qbittorrent.torrents_set_force_start(torrent_hash) + else: + self.qbittorrent.start_torrents(torrent_hash) return torrent_hash, f"添加下载成功,已选择集数:{sucess_epidised}" else: + if settings.QB_FORCE_RESUME: + self.qbittorrent.torrents_set_force_start(torrent_hash) return torrent_hash, "添加下载成功" def list_torrents(self, status: TorrentStatus = None, diff --git a/config/app.env b/config/app.env index ffb01a14..cc40755e 100644 --- a/config/app.env +++ b/config/app.env @@ -143,6 +143,8 @@ QB_PASSWORD= QB_CATEGORY=false # Qbittorrent按顺序下载 QB_SEQUENTIAL=true +# Qbittorrent忽略队列限制,强制继续 +QB_FORCE_RESUME=false # Transmission地址,IP:PORT TR_HOST= # Transmission用户名