通过命令行管理夸克自动转存任务 (QAS,夸克自动转存,夸克转存,夸克订阅,管理任务,运行任务,修复失效链接,pan.quark.cn)
Manage quark-auto-save tasks via CLI.
QAS, 夸克自动转存, 夸克转存, 夸克订阅, 管理任务, 运行任务, 修复失效链接
When user send message like https://pan.quark.cn/s/***, get detail, add a QAS task.
Env:
QAS_BASE_URL - User provided, e.g., http://192.168.1.x:5005QAS_TOKEN - User providedActual configuration values are recorded in TOOLS.md, Do not modify SKILL.md
After the user sets the token, the following analysis must be performed and recorded in TOOLS.md:
Get Current Configuration: bash
python3 {baseDir}/scripts/qas_client.py get-config
Analyze Saving Habits:
savepath directory patterns from existing tasks (e.g., /video/tv/, /video/anime/, /video/movie/)pattern + replace: deduce the final renamed filename format by applying the regex to a sample source file (e.g., 01.mp4 → Black Mirror.S01E01.mp4). Record the result pattern, not the raw regex.magic_regex key the user prefers (e.g. $TV_MAGIC)Record to TOOLS.md: The following is just an example, not specific values, everything is analyzed based on user configuration. markdown
### quark-auto-save habits
#### TV Series
- Directory: `/video/tv/{name}`
- naming preferences: `$TV_MAGIC `(e.g., {TASKNAME}.{SXX}E{E}.{EXT})
/video/anime/{name}Rick and Morty.S01E01.mp4/video/movie/{name} {year}{TASKNAME}.mp4...
## Python Client
Use `{baseDir}/scripts/qas_client.py` for all operations:
bash
```bash
python3 {baseDir}/scripts/qas_client.py get-config # Get all config & tasks
python3 {baseDir}/scripts/qas_client.py search "query" [-d] # Search resources
python3 {baseDir}/scripts/qas_client.py get-share "<shareurl>" [-a] # Get share detail (-a for all files)
python3 {baseDir}/scripts/qas_client.py check-path "/path" # Check savepath
python3 {baseDir}/scripts/qas_client.py delete-file "/path/to/file" # Delete cloud file
python3 {baseDir}/scripts/qas_client.py rename-file "/path/to/file" "new_name" # Rename cloud file
python3 {baseDir}/scripts/qas_client.py add-task '{"taskname": "Name", ...}' # Add task
python3 {baseDir}/scripts/qas_client.py run-task [taskname|json] # Run task(s)
python3 {baseDir}/scripts/qas_client.py update-task "TaskName" '{"savepath": "/new"}' # Update task
python3 {baseDir}/scripts/qas_client.py delete-task "TaskName" # Delete task
python3 {baseDir}/scripts/qas_client.py update-config '{"key": "value"}' # Update config
json
{
"taskname": "MediaName",
"shareurl": "https://pan.quark.cn/s/xxx#/list/share/fid",
"savepath": "/video/tv/MediaName",
"pattern": "$TV_MAGIC",
"replace": "",
"update_subdir": "",
"ignore_extension": false,
"runweek": [1,2,3,4,5,6,7]
}
Required Fields: taskname, shareurl, savepath
Optional Fields: pattern, replace, update_subdir, ignore_extension, runweek, addition
add-taskauto-detects zip/rar/7z files and enablesauto_unarchiveplugin automatically. No manualadditionconfig needed for this.
shareurl Format#https://pan.quark.cn/s/{abc123}https://pan.quark.cn/s/{abc123}#/list/share/{fid}Archive files (zip, rar, 7z) are also supported — auto-unarchive is enabled automatically by
add-taskrun-task.
Get subdir info:
bash
python3 {baseDir}/scripts/qas_client.py get-share "<shareurl>"
Add task example:
bash
python3 {baseDir}/scripts/qas_client.py add-task '{"taskname": "Black Mirror", "shareurl": "https://pan.quark.cn/s/xxx", "savepath": "/video/tv/Black Mirror", "pattern": "$TV_MAGIC"}'
pattern & replace#WIKI:
PatternReplaceResult.*Save all files\.(mp4|mkv)$Save video files only^(\d+)\.mp4``S02E\1.mp401.mp4 → S02E01.mp4$TV_MAGICUse custom magic regex
replace Magic Variables#VariableDescription{TASKNAME}Task name{II}Index number (01, 02...){EXT}File extension{SXX}Season (S01, S02...){E}Episode number{DATE}Date (YYYYMMDD)
Search: python3 {baseDir}/scripts/qas_client.py search "MediaName" -d
Verify & Get Details: python3 {baseDir}/scripts/qas_client.py get-share "<shareurl>"
shareurl is valid (not banned)Analyze pattern & replace: Ensure the final renamed filename matches the naming preferences in TOOLS.md.
"pattern": ".*", replace: "" (save as-is)pattern to capture groups, replace with magic variables. E.g., source 01.mp4, TOOLS.md says Black Mirror.S01E01.mp4 → "pattern": "^(\\d+)\\.mp4$", "replace": "{TASKNAME}.S01E\\1.{EXT}"Execute:
X集全, 全X集, 完结, 全集, single movie) → run-taskadd-taskbash
# One-time (completed)
python3 {baseDir}/scripts/qas_client.py run-task '{"taskname": "MediaName", "shareurl": "...", "savepath": "...", "pattern": "...", "replace": "..."}'
# Subscription (ongoing)
python3 {baseDir}/scripts/qas_client.py add-task '{"taskname": "MediaName", "shareurl": "...", "savepath": "...", "pattern": "...", "replace": "..."}'
savepath and ( pattern + replace) MUST follow the user's existing habits recorded in TOOLS.mdrun-task "TaskName" immediately to execute the first save.Get tasks: python3 {baseDir}/scripts/qas_client.py get-config
Identify invalid tasks: tasks with shareurl_ban key in tasklist
Check existing files: python3 {baseDir}/scripts/qas_client.py check-path "<task_savepath>" — record the naming format and the latest episode number (e.g., E24) of already-saved files
Find replacement: python3 {baseDir}/scripts/qas_client.py search "<taskname>" -d to get candidate shareurls
Verify & select shareurl:
python3 {baseDir}/scripts/qas_client.py get-share "<candidate_shareurl>" -a — check file list.mkv → pick .mkv source, existing .mp4 → pick .mp4 source)pattern/ replace so the final renamed result matches the existing naming. If source already matches, keep pattern/ replace unchanged.Update task: python3 {baseDir}/scripts/qas_client.py update-task "TaskName" '{"shareurl": "<verified_url>", "shareurl_ban": "", "pattern": "...", "replace": "..."}' — include pattern/ replace if they were adjusted
Trigger run: python3 {baseDir}/scripts/qas_client.py run-task "TaskName" — execute immediately after fixing the link.
bash
python3 {baseDir}/scripts/qas_client.py delete-task "TaskName"
bash
# Partial update (only specified fields are changed)
python3 {baseDir}/scripts/qas_client.py update-task "TaskName" '{"savepath": "/new/path"}'
python3 {baseDir}/scripts/qas_client.py update-task "TaskName" '{"pattern": "$TV_MAGIC", "runweek": [1,3,5]}'
bash
# Update global config (allowed keys: cookie, crontab, push_config, tasklist, magic_regex, plugins, source)
python3 {baseDir}/scripts/qas_client.py update-config '{"crontab": "0 9 * * *"}'
bash
python3 {baseDir}/scripts/qas_client.py run-task # All tasks
python3 {baseDir}/scripts/qas_client.py run-task "TaskName" # Specific task
python3 {baseDir}/scripts/qas_client.py run-task '{"taskname": "Test", ...}' # Direct task
All commands output text. First word indicates status:
OK on first line, followed by log lines