fix speedlimiter

This commit is contained in:
jxxghp
2023-08-07 08:30:06 +08:00
parent cde105854a
commit f46af991cd
6 changed files with 217 additions and 19 deletions

View File

@ -106,6 +106,8 @@ class Qbittorrent(metaclass=Singleton):
:param ids: 种子Hash列表
:param tag: 标签内容
"""
if not self.qbc:
return False
try:
self.qbc.torrents_delete_tags(torrent_hashes=ids, tags=tag)
return True
@ -129,6 +131,8 @@ class Qbittorrent(metaclass=Singleton):
"""
设置强制作种
"""
if not self.qbc:
return
try:
self.qbc.torrents_set_force_start(enable=True, torrent_hashes=ids)
except Exception as err:
@ -266,6 +270,8 @@ class Qbittorrent(metaclass=Singleton):
"""
获取种子文件清单
"""
if not self.qbc:
return None
try:
return self.qbc.torrents_files(torrent_hash=tid)
except Exception as err:
@ -276,6 +282,8 @@ class Qbittorrent(metaclass=Singleton):
"""
设置下载文件的状态priority为0为不下载priority为1为下载
"""
if not self.qbc:
return False
if not kwargs.get("torrent_hash") or not kwargs.get("file_ids"):
return False
try:
@ -291,6 +299,8 @@ class Qbittorrent(metaclass=Singleton):
"""
获取传输信息
"""
if not self.qbc:
return None
try:
return self.qbc.transfer_info()
except Exception as err:

View File

@ -115,6 +115,8 @@ class Transmission(metaclass=Singleton):
"""
设置种子标签
"""
if not self.trc:
return False
if not ids or not tags:
return False
try:
@ -138,6 +140,8 @@ class Transmission(metaclass=Singleton):
:param cookie: 站点Cookie用于辅助下载种子
:return: Torrent
"""
if not self.trc:
return None
try:
return self.trc.add_torrent(torrent=content,
download_dir=download_dir,
@ -193,6 +197,8 @@ class Transmission(metaclass=Singleton):
"""
获取种子文件列表
"""
if not self.trc:
return None
if not tid:
return None
try:
@ -209,6 +215,8 @@ class Transmission(metaclass=Singleton):
"""
设置下载文件的状态
"""
if not self.trc:
return False
try:
self.trc.change_torrent(ids=tid, files_wanted=file_ids)
return True
@ -220,6 +228,8 @@ class Transmission(metaclass=Singleton):
"""
获取传输信息
"""
if not self.trc:
return None
try:
return self.trc.session_stats()
except Exception as err: