Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复了IYUU自动辅种插件 #800

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/downloader/client/qbittorrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ def get_torrents(self, ids=None, status=None, tag=None):
"""
if not self.qbc:
return [], True

try:
if status and len(status) == 1:
status = status[0]
torrents = self.qbc.torrents_info(torrent_hashes=ids,
status_filter=status)
if tag:
Expand Down Expand Up @@ -513,7 +516,7 @@ def stop_torrents(self, ids):
if not self.qbc:
return False
try:
return self.qbc.torrents_pause(torrent_hashes=ids)
return self.qbc.torrents_stop(torrent_hashes=ids)
except Exception as err:
log.error(f"【{self.client_name}】{self.name} 停止下载出错:{str(err)}")
return False
Expand Down
16 changes: 11 additions & 5 deletions app/plugins/modules/iyuu/iyuu_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@singleton
class IyuuHelper(object):
_version = "8.2.0"
_api_base = "https://dev.iyuu.cn"
_api_base = "https://2025.iyuu.cn"
_sites = {}
_token = None
_sid_sha1 = None
Expand All @@ -32,6 +32,11 @@ def __request_iyuu(self, url, method="get", params=None):
accept_type="application/json",
headers={'token': self._token}
).get_res(f"{self._api_base + url}", params=params)
elif method == "postForm":
ret = RequestUtils(
accept_type="application/x-www-form-urlencoded",
headers={'token': self._token}
).post_res(f"{self._api_base + url}", data=params)
else:
ret = RequestUtils(
accept_type="application/json",
Expand Down Expand Up @@ -139,7 +144,7 @@ def get_seed_info(self, info_hashs: list):
json_data = json.dumps(info_hashs, separators=(',', ':'), ensure_ascii=False)
sha1 = self.get_sha1(json_data)
result, msg = self.__request_iyuu(url='/reseed/index/index',
method="post",
method="postForm",
params={
'hash': json_data,
'sha1': sha1,
Expand Down Expand Up @@ -174,7 +179,7 @@ def get_auth_sites(self):
print(msg)
return []

def bind_site(self, site, passkey, uid):
def bind_site(self, site, sid, passkey, uid):
"""
绑定站点
:param site: 站点名称
Expand All @@ -183,11 +188,12 @@ def bind_site(self, site, passkey, uid):
:return: 状态码、错误信息
"""
result, msg = self.__request_iyuu(url='/reseed/users/bind',
method="post",
method="postForm",
params={
"token": self._token,
"site": site,
"passkey": self.get_sha1(passkey),
"id": uid
"id": int(uid),
"sid": int(sid)
})
return result, msg
7 changes: 5 additions & 2 deletions app/plugins/modules/iyuuautoseed.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def get_page(self):
<label class="form-label required">IYUU合作站点</label>
<select class="form-control" id="iyuuautoseed_site" onchange="">
{% for Site in AuthSites %}
<option value="{{ Site.site }}">{{ Site.site }}</option>
<option value="{{ Site.site }}&&{{ Site.sid }}">{{ Site.site }}</option>
{% endfor %}
</select>
</div>
Expand Down Expand Up @@ -350,7 +350,10 @@ def iyuu_bind_site(self, site, passkey, uid):
"""
IYUU绑定合作站点
"""
state, msg = self.iyuuhelper.bind_site(site=site,
info = site.split("&&")

state, msg = self.iyuuhelper.bind_site(site=info[0],
sid=info[1],
passkey=passkey,
uid=uid)
return {"code": 0 if state else 1, "msg": msg}
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ python_hosts==1.0.3
pytz==2023.3
pytz-deprecation-shim==0.1.0.post0
PyVirtualDisplay==3.0
qbittorrent-api==2023.9.53
qbittorrent-api==2024.11.70
redis==3.5.3
redis-py-cluster==2.1.3
regex==2023.8.8
Expand Down