-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Alist存储间的复制优化 #3776
Labels
enhancement
New feature or request
Comments
Thanks for opening your first issue here! Be sure to follow the issue template! |
See
|
非#3507所述问题 |
同时希望支持筛选出错的任务并重试 |
下面是我用python实现的功能,可能有问题(别喷我的代码),但可以临时用一下(有大佬能帮忙优化一下最好🙃): import re
import requests
# 你部署alist的网址,如http://xx.xx,https://xx.xx
domain = ""
state_url = domain + "/api/admin/task/copy/done"
copy_url = domain + "/api/fs/copy"
clear_url = domain + "/api/admin/task/copy/delete?tid="
# 管理-设置-其他-令牌里的东西
auth_token = ""
def retry_failed_task():
header = {"Authorization": auth_token}
req = requests.get(state_url, headers=header)
data = req.json()
if data["code"] == 200:
data = data["data"]
if data:
for task in data:
if task["state"] == "errored":
task_content = task["name"]
pre_dirs = re.findall(r"\[.+?\]", task_content)
pre_content = re.findall(r"\(.+?\)", task_content)
pre_src_dir = pre_dirs[0][1:-1]
pre_src_dir += pre_content[0][1:-1]
split_point = pre_src_dir.rfind("/")
src_dir = pre_src_dir[:split_point]
names = [pre_src_dir[split_point + 1:]]
dst_dir = pre_dirs[-int(len(pre_dirs)/2)][1:-1] + pre_content[-int(len(pre_content)/2)][1:-1]
add_task = {"src_dir": src_dir, "dst_dir": dst_dir, "names": names}
req = requests.post(copy_url, headers=header, json=add_task)
result = req.json()
if result["code"] != 200:
print(task_content)
print(result)
else:
print("retry success")
print(requests.post(clear_url+task["id"], headers=header).json())
else:
print(requests.post(clear_url+task["id"], headers=header).json())
else:
print(data)
retry_failed_task() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please make sure of the following things
Description of the feature / 需求描述
当复制文件过多时http://127.0.0.1:5244/@manage/tasks/copy界面会非常卡,希望可以分割已完成和未完成任务
Suggested solution / 实现思路
通过分页或限制页面dom加载数量实现性能优化
Additional context / 附件
No response
The text was updated successfully, but these errors were encountered: