mirror of
https://github.com/Cp0204/quark-auto-save.git
synced 2026-01-15 00:40:43 +08:00
Compare commits
3 Commits
fe4643ff7c
...
179856adca
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
179856adca | ||
|
|
ad4026955f | ||
|
|
a5369e0138 |
4
.dockerignore
Normal file
4
.dockerignore
Normal file
@ -0,0 +1,4 @@
|
||||
.git
|
||||
.github
|
||||
__pycache__
|
||||
/img
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
quark_config_debug.json
|
||||
__pycache__
|
||||
/config
|
||||
/config
|
||||
.vscode
|
||||
@ -8,7 +8,7 @@ WORKDIR /app
|
||||
COPY . /app
|
||||
|
||||
# 安装依赖
|
||||
RUN pip install --no-cache-dir flask apscheduler requests treelib
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# 时区
|
||||
ENV TZ="Asia/Shanghai"
|
||||
|
||||
@ -14,16 +14,16 @@
|
||||
|
||||
* **`default_config`**:字典,包含模块所需参数及其默认值。例如:
|
||||
|
||||
```python
|
||||
# 该模块必须配置的键,值可留空
|
||||
default_config = {"url": "", "token": ""}
|
||||
```
|
||||
```python
|
||||
# 该模块必须配置的键,值可留空
|
||||
default_config = {"url": "", "token": ""}
|
||||
```
|
||||
|
||||
* **`is_active`**:布尔值,默认为 `False`.
|
||||
|
||||
* **`__init__(self, **kwargs)`**:构造函数,接收配置参数 `kwargs`。它应该:
|
||||
1. 检查 `kwargs` 是否包含所有 `default_config` 中的参数,缺少参数则打印警告。
|
||||
2. 若参数完整,尝试连接服务器并验证配置,成功则设置 `self.is_active = True`。
|
||||
1. 检查 `kwargs` 是否包含所有 `default_config` 中的参数,缺少参数则打印警告。
|
||||
2. 若参数完整,尝试连接服务器并验证配置,成功则设置 `self.is_active = True`。
|
||||
|
||||
* **`run(self, task)`**:整个模块入口函数,处理模块逻辑。
|
||||
* `task` 是一个字典,包含任务信息。如果需要修改任务参数,返回修改后的 `task` 字典;
|
||||
|
||||
@ -46,15 +46,16 @@ class Alist:
|
||||
def refresh(self, path, force_refresh=True):
|
||||
url = f"{self.url}/api/fs/list"
|
||||
headers = {"Authorization": self.token}
|
||||
querystring = {
|
||||
payload = {
|
||||
"path": path,
|
||||
"refresh": force_refresh,
|
||||
"password": "",
|
||||
"page": 1,
|
||||
"per_page": 0,
|
||||
}
|
||||
try:
|
||||
response = requests.request(
|
||||
"POST", url, headers=headers, params=querystring
|
||||
"POST", url, headers=headers, json=payload
|
||||
)
|
||||
response.raise_for_status()
|
||||
response = response.json()
|
||||
|
||||
4
requirements.txt
Normal file
4
requirements.txt
Normal file
@ -0,0 +1,4 @@
|
||||
flask
|
||||
apscheduler
|
||||
requests
|
||||
treelib
|
||||
Loading…
Reference in New Issue
Block a user