From fb311f3d8a4291cec5c19424b5362db867aae011 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Thu, 9 Jan 2025 07:59:17 +0800 Subject: [PATCH] fix #3583 --- app/modules/qbittorrent/__init__.py | 5 ++--- app/modules/qbittorrent/qbittorrent.py | 11 +++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/modules/qbittorrent/__init__.py b/app/modules/qbittorrent/__init__.py index 2b829838..8e1ae650 100644 --- a/app/modules/qbittorrent/__init__.py +++ b/app/modules/qbittorrent/__init__.py @@ -134,10 +134,9 @@ class QbittorrentModule(_ModuleBase, _DownloaderBase[Qbittorrent]): category=category, ignore_category_check=False ) - # 获取下载器全局设置 - application = server.qbc.application.preferences + # 获取种子内容布局: `Original: 原始, Subfolder: 创建子文件夹, NoSubfolder: 不创建子文件夹` - torrent_layout = application.get("torrent_content_layout", "Original") + torrent_layout = server.get_content_layout() if not state: # 读取种子的名称 diff --git a/app/modules/qbittorrent/qbittorrent.py b/app/modules/qbittorrent/qbittorrent.py index b19f1d28..0c764fbb 100644 --- a/app/modules/qbittorrent/qbittorrent.py +++ b/app/modules/qbittorrent/qbittorrent.py @@ -448,3 +448,14 @@ class Qbittorrent: except Exception as err: logger.error(f"修改tracker出错:{str(err)}") return False + + def get_content_layout(self) -> Optional[str]: + """ + 获取内容布局 + """ + if not self.qbc: + return None + # 获取下载器全局设置 + application = self.qbc.application.preferences + # 获取种子内容布局: `Original: 原始, Subfolder: 创建子文件夹, NoSubfolder: 不创建子文件夹` + return application.get("torrent_content_layout", "Original")