From 2b0d9360aab51136fe15c0b3dc7b1b4abc8630dd Mon Sep 17 00:00:00 2001 From: fengfeng Date: Wed, 30 Oct 2024 20:06:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 8 +++++ readme.md | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 105 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 57ef06b..283d02c 100644 --- a/main.py +++ b/main.py @@ -6,6 +6,7 @@ import threading import colorlog from pikpakFs import PKFs, IsDir, IsFile, PKTaskStatus import os +import json def setup_logging(): formatter = colorlog.ColoredFormatter( @@ -275,6 +276,13 @@ class Console(cmd2.Cmd): for task in tasks: await self.AsyncPrint(f"{task.id}: {task.status.name}") + def print_debug(self, jsonObject): + logging.debug(json.dumps(jsonObject, indent=4)) + + @RunSync + async def do_test(self, args): + self.print_debug(await Client.client.offline_list()) + async def mainLoop(): global MainLoop, Client MainLoop = asyncio.get_running_loop() diff --git a/readme.md b/readme.md index ee580ff..2f562ec 100644 --- a/readme.md +++ b/readme.md @@ -8,4 +8,100 @@ Todo: - [x] 异步输出频率过高会导致卡死,似乎会多创建一个线程 - [ ] 实现Task队列管理 - [ ] 自动刷新文件系统缓存 -- [ ] 分析以下方法的返回值:offline_file_info、offline_list、offline_task_retry、delete_tasks \ No newline at end of file +- [ ] 分析以下方法的返回值:offline_file_info、offline_list + + +### 记录 +1. offline_download +```json +{ + "upload_type": "UPLOAD_TYPE_URL", + "url": { + "kind": "upload#url" + }, + "task": { + "kind": "drive#task", + "id": "VOAMocJorcA09bRr-3bEDUbYo1", + "name": "[FLsnow][Genshiken-2daime][BDRip]", + "type": "offline", + "user_id": "ZEBRT8Wc1IzU1rfZ", + "statuses": [], + "status_size": 56, + "params": { + "predict_speed": "73300775185", + "predict_type": "3" + }, + "file_id": "VOAMocKArcA09bRr-3bEDUbZo1", + "file_name": "[FLsnow][Genshiken-2daime][BDRip]", + "file_size": "29071069771", + "message": "Saving", + "created_time": "2024-10-29T18:29:11.092+08:00", + "updated_time": "2024-10-29T18:29:11.092+08:00", + "third_task_id": "", + "phase": "PHASE_TYPE_RUNNING", + "progress": 0, + "icon_link": "", + "callback": "", + "space": "" + } +} +``` + +2. offline_file_info +```json +{ + "kind": "drive#folder", + "id": "VOAMocKArcA09bRr-3bEDUbZo1", + "parent_id": "VNTQEPvYTRlbqP1pB2YGZorwo1", + "name": "[FLsnow][Genshiken-2daime][BDRip](1)", + "user_id": "ZEBRT8Wc1IzU1rfZ", + "size": "0", + "revision": "0", + "file_extension": "", + "mime_type": "", + "starred": false, + "web_content_link": "", + "created_time": "2024-10-29T18:29:13.251+08:00", + "modified_time": "2024-10-29T18:29:13.251+08:00", + "icon_link": "https://static.mypikpak.com/7d6933d5cde34f200366685cba0cbc4592cfd363", + "thumbnail_link": "https://sg-thumbnail-drive.mypikpak.com/v0/screenshot-thumbnails/788AB60820B162FD988606CE988FBC40B8C6EA8D/720/2048", + "md5_checksum": "", + "hash": "", + "links": {}, + "phase": "PHASE_TYPE_COMPLETE", + "audit": { + "status": "STATUS_OK", + "message": "Normal resource", + "title": "" + }, + "medias": [], + "trashed": false, + "delete_time": "", + "original_url": "", + "params": { + "platform_icon": "https://static.mypikpak.com/21ecdc2c6b2372cdee91b193df9a6248b885a1b0", + "small_thumbnail": "https://sg-thumbnail-drive.mypikpak.com/v0/screenshot-thumbnails/788AB60820B162FD988606CE988FBC40B8C6EA8D/240/720", + "url": "magnet:?xt=urn:btih:7c0e7e3e3828c22b49e903beefcee69ec2a4986e" + }, + "original_file_index": 0, + "space": "", + "apps": [], + "writable": true, + "folder_type": "NORMAL", + "sort_name": "", + "user_modified_time": "2024-10-29T18:29:13.251+08:00", + "spell_name": [], + "file_category": "OTHER", + "tags": [], + "reference_events": [] +} +``` + +3. offline_list +```json +{ + "tasks": [], + "next_page_token": "", + "expires_in": 10 +} +``` \ No newline at end of file