-
Notifications
You must be signed in to change notification settings - Fork 825
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from aligo import Aligo | ||
|
||
ali = Aligo(refresh_token='316bb9995a2b4ac79632040687a08be2') | ||
|
||
# 这里默认使用资源盘 | ||
v2_user = ali.v2_user_get() | ||
resource_drive_id = v2_user.resource_drive_id | ||
ali.default_drive_id = resource_drive_id | ||
|
||
file_list = ali.get_file_list() | ||
folder_id = '' | ||
for folder in file_list: | ||
if folder.name == '小雅转存文件夹': | ||
folder_id = folder.file_id | ||
break | ||
if not folder_id: | ||
folder_id = ali.create_folder(name='小雅转存文件夹').file_id | ||
|
||
print(folder_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
Green="\033[32m" | ||
Red="\033[31m" | ||
Yellow='\033[33m' | ||
Font="\033[0m" | ||
INFO="[${Green}INFO${Font}]" | ||
ERROR="[${Red}ERROR${Font}]" | ||
WARN="[${Yellow}WARN${Font}]" | ||
function INFO() { | ||
echo -e "${INFO} ${1}" | ||
} | ||
function ERROR() { | ||
echo -e "${ERROR} ${1}" | ||
} | ||
function WARN() { | ||
echo -e "${WARN} ${1}" | ||
} | ||
|
||
if ! folderid=$(python /get_folder_id/get_folder_id.py); then | ||
ERROR "自动获取 阿里云盘转存目录 folder id 失败,请手动获取!" | ||
exit 1 | ||
fi | ||
if [ -n "${folderid}" ]; then | ||
INFO "阿里云盘转存目录 folder id:${folderid}" | ||
else | ||
ERROR "自动获取 阿里云盘转存目录 folder id 失败,请手动获取!" | ||
exit 1 | ||
fi | ||
|
||
|
||
echo "${folderid}" > /data/temp_transfer_folder_id.txt | ||
echo "r" > /data/folder_type.txt | ||
|
||
refresh_token=$(sed 's/:\s*/:/g' /root/.aligo/aligo.json | sed -n 's/.*"refresh_token":"\([^"]*\).*/\1/p') | ||
|
||
INFO "自动刷新 refresh_token:${refresh_token}" | ||
|
||
echo "${refresh_token}" > /data/mytoken.txt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
aligo |