From 4619158b99d7fb13d7ef29875fa86e56c989b055 Mon Sep 17 00:00:00 2001 From: hoey94 Date: Fri, 15 Mar 2024 18:23:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=99=90=E9=80=9F=E5=BC=80=E5=85=B3BUG?= =?UTF-8?q?=20104?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/modules/qbittorrent/qbittorrent.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/app/modules/qbittorrent/qbittorrent.py b/app/modules/qbittorrent/qbittorrent.py index 07ca29d5..b2007332 100644 --- a/app/modules/qbittorrent/qbittorrent.py +++ b/app/modules/qbittorrent/qbittorrent.py @@ -133,7 +133,7 @@ class Qbittorrent: except Exception as err: logger.error(f"删除种子Tag出错:{str(err)}") return False - + def remove_torrents_tag(self, ids: Union[str, list], tag: Union[str, list]) -> bool: """ 移除种子Tag @@ -148,7 +148,7 @@ class Qbittorrent: except Exception as err: logger.error(f"移除种子Tag出错:{str(err)}") return False - + def set_torrents_tag(self, ids: Union[str, list], tags: list): """ 设置种子状态为已整理,以及是否强制做种 @@ -372,6 +372,24 @@ class Qbittorrent: logger.error(f"设置速度限制出错:{str(err)}") return False + def get_speed_limit(self): + """ + 获取QB速度 + :return: 返回download_limit 和upload_limit ,默认是0 + """ + if not self.qbc: + return False + + download_limit = 0 + upload_limit = 0 + try: + download_limit = self.qbc.transfer.download_limit + upload_limit = self.qbc.transfer.upload_limit + except Exception as err: + logger.error(f"获取速度限制出错:{str(err)}") + + return (download_limit/1024, upload_limit/1024) + def recheck_torrents(self, ids: Union[str, list]) -> bool: """ 重新校验种子