fix
This commit is contained in:
parent
d4c28500b7
commit
366f59623a
@ -186,7 +186,8 @@ class Qbittorrent(metaclass=Singleton):
|
||||
download_dir: str = None,
|
||||
tag: Union[str, list] = None,
|
||||
category: str = None,
|
||||
cookie=None
|
||||
cookie=None,
|
||||
**kwargs
|
||||
) -> bool:
|
||||
"""
|
||||
添加种子
|
||||
@ -238,7 +239,8 @@ class Qbittorrent(metaclass=Singleton):
|
||||
use_auto_torrent_management=is_auto,
|
||||
is_sequential_download=True,
|
||||
cookie=cookie,
|
||||
category=category)
|
||||
category=category,
|
||||
**kwargs)
|
||||
return True if qbc_ret and str(qbc_ret).find("Ok") != -1 else False
|
||||
except Exception as err:
|
||||
logger.error(f"添加种子出错:{err}")
|
||||
|
@ -288,3 +288,58 @@ class Transmission(metaclass=Singleton):
|
||||
except Exception as err:
|
||||
logger.error(f"添加Tracker出错:{err}")
|
||||
return False
|
||||
|
||||
def change_torrent(self,
|
||||
hash_string: str,
|
||||
upload_limit=None,
|
||||
download_limit=None,
|
||||
ratio_limit=None,
|
||||
seeding_time_limit=None):
|
||||
"""
|
||||
设置种子
|
||||
:param hash_string: ID
|
||||
:param upload_limit: 上传限速 Kb/s
|
||||
:param download_limit: 下载限速 Kb/s
|
||||
:param ratio_limit: 分享率限制
|
||||
:param seeding_time_limit: 做种时间限制
|
||||
:return: bool
|
||||
"""
|
||||
if not hash_string:
|
||||
return False
|
||||
if upload_limit:
|
||||
uploadLimited = True
|
||||
uploadLimit = int(upload_limit)
|
||||
else:
|
||||
uploadLimited = False
|
||||
uploadLimit = 0
|
||||
if download_limit:
|
||||
downloadLimited = True
|
||||
downloadLimit = int(download_limit)
|
||||
else:
|
||||
downloadLimited = False
|
||||
downloadLimit = 0
|
||||
if ratio_limit:
|
||||
seedRatioMode = 1
|
||||
seedRatioLimit = round(float(ratio_limit), 2)
|
||||
else:
|
||||
seedRatioMode = 2
|
||||
seedRatioLimit = 0
|
||||
if seeding_time_limit:
|
||||
seedIdleMode = 1
|
||||
seedIdleLimit = int(seeding_time_limit)
|
||||
else:
|
||||
seedIdleMode = 2
|
||||
seedIdleLimit = 0
|
||||
try:
|
||||
self.trc.change_torrent(ids=hash_string,
|
||||
uploadLimited=uploadLimited,
|
||||
uploadLimit=uploadLimit,
|
||||
downloadLimited=downloadLimited,
|
||||
downloadLimit=downloadLimit,
|
||||
seedRatioMode=seedRatioMode,
|
||||
seedRatioLimit=seedRatioLimit,
|
||||
seedIdleMode=seedIdleMode,
|
||||
seedIdleLimit=seedIdleLimit)
|
||||
except Exception as err:
|
||||
logger.error(f"设置种子出错:{err}")
|
||||
return False
|
||||
|
@ -850,8 +850,12 @@ class BrushFlow(_PluginBase):
|
||||
continue
|
||||
# 保存任务信息
|
||||
task_info[hash_string] = {
|
||||
"site_name": torrent.site_name,
|
||||
"size": torrent.size
|
||||
"site": siteinfo.id,
|
||||
"site_name": siteinfo.name,
|
||||
"title": torrent.title,
|
||||
"size": torrent.size,
|
||||
"pubdate": torrent.pubdate,
|
||||
"state": "Y"
|
||||
}
|
||||
# 发送消息
|
||||
self.__send_add_message(torrent)
|
||||
@ -988,7 +992,9 @@ class BrushFlow(_PluginBase):
|
||||
state = self.qb.add_torrent(content=torrent.enclosure,
|
||||
download_dir=self._save_path or None,
|
||||
cookie=torrent.site_cookie,
|
||||
tag=["已整理", "刷流", tag])
|
||||
tag=["已整理", "刷流", tag],
|
||||
upload_limit=self._up_speed or None,
|
||||
download_limit=self._dl_speed or None)
|
||||
if not state:
|
||||
return None
|
||||
else:
|
||||
@ -1009,6 +1015,10 @@ class BrushFlow(_PluginBase):
|
||||
if not torrent:
|
||||
return None
|
||||
else:
|
||||
if self._up_speed or self._dl_speed:
|
||||
self.tr.change_torrent(hash_string=torrent.hashString,
|
||||
upload_limit=self._up_speed,
|
||||
download_limit=self._dl_speed)
|
||||
return torrent.hashString
|
||||
return None
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user