bdpan-cli 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bdpan_cli-0.1.0/PKG-INFO +167 -0
- bdpan_cli-0.1.0/README.md +139 -0
- bdpan_cli-0.1.0/pyproject.toml +63 -0
- bdpan_cli-0.1.0/pyproject.toml.orig +56 -0
- bdpan_cli-0.1.0/src/bdpan_cli/__init__.py +15 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/__init__.py +9 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/__init__.py +27 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/api/__init__.py +6 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/api/auth_api.py +649 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/api/fileinfo_api.py +737 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/api/filemanager_api.py +669 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/api/fileupload_api.py +599 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/api/multimediafile_api.py +391 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/api/userinfo_api.py +315 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/api_client.py +864 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/configuration.py +454 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/exceptions.py +197 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/model/__init__.py +5 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/model/oauth_token_authorization_code_response.py +276 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/model/oauth_token_device_code_response.py +276 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/model/oauth_token_device_token_response.py +276 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/model/oauth_token_refresh_token_response.py +276 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/model/quotaresponse.py +276 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/model/uinforesponse.py +284 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/model_utils.py +2039 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_vendor/openapi_client/rest.py +385 -0
- bdpan_cli-0.1.0/src/bdpan_cli/_version.py +3 -0
- bdpan_cli-0.1.0/src/bdpan_cli/account.py +78 -0
- bdpan_cli-0.1.0/src/bdpan_cli/apply_scrape_rename.py +99 -0
- bdpan_cli-0.1.0/src/bdpan_cli/auth.py +218 -0
- bdpan_cli-0.1.0/src/bdpan_cli/cli.py +1428 -0
- bdpan_cli-0.1.0/src/bdpan_cli/config.py +26 -0
- bdpan_cli-0.1.0/src/bdpan_cli/dedup.py +310 -0
- bdpan_cli-0.1.0/src/bdpan_cli/downloader.py +178 -0
- bdpan_cli-0.1.0/src/bdpan_cli/file_manager.py +389 -0
- bdpan_cli-0.1.0/src/bdpan_cli/foldering.py +181 -0
- bdpan_cli-0.1.0/src/bdpan_cli/logger.py +101 -0
- bdpan_cli-0.1.0/src/bdpan_cli/mcp_server.py +547 -0
- bdpan_cli-0.1.0/src/bdpan_cli/media_info.py +251 -0
- bdpan_cli-0.1.0/src/bdpan_cli/ops.py +173 -0
- bdpan_cli-0.1.0/src/bdpan_cli/organize.py +108 -0
- bdpan_cli-0.1.0/src/bdpan_cli/preview_scrape.py +182 -0
- bdpan_cli-0.1.0/src/bdpan_cli/scraper.py +505 -0
- bdpan_cli-0.1.0/src/bdpan_cli/uploader.py +391 -0
bdpan_cli-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: bdpan-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: 百度网盘工程化 CLI 管理工具
|
|
5
|
+
Keywords: baidu-pan,netdisk,cli,scraper,backup,cloud-storage
|
|
6
|
+
Author: CodingRookie98
|
|
7
|
+
Author-email: CodingRookie98 <520whjoker@gmail.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Topic :: System :: Archiving
|
|
19
|
+
Classifier: Topic :: Utilities
|
|
20
|
+
Requires-Dist: python-dotenv>=1.2.3
|
|
21
|
+
Requires-Dist: urllib3>=1.25.3
|
|
22
|
+
Requires-Dist: python-dateutil>=2.9.0.post0
|
|
23
|
+
Requires-Python: >=3.12
|
|
24
|
+
Project-URL: Homepage, https://github.com/CodingRookie98/bdpan-cli
|
|
25
|
+
Project-URL: Repository, https://github.com/CodingRookie98/bdpan-cli
|
|
26
|
+
Project-URL: Documentation, https://github.com/CodingRookie98/bdpan-cli#readme
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# bdpan-cli
|
|
30
|
+
|
|
31
|
+
[](https://opensource.org/licenses/MIT)
|
|
32
|
+
[](https://www.python.org/downloads/)
|
|
33
|
+
[](https://github.com/astral-sh/uv)
|
|
34
|
+
|
|
35
|
+
[中文](README.md) | [English](README_en.md)
|
|
36
|
+
|
|
37
|
+
百度网盘工程化 CLI 管理工具。基于[百度网盘开放平台](https://pan.baidu.com/union/doc/)官方 SDK 与协议标准构建,提供文件管理、分片上传续传、冲突副本治理与影视媒体库规范化自动化刮削整理。
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 快速安装 (Installation)
|
|
42
|
+
|
|
43
|
+
### 方式 1:uv tool 安装(推荐,隔离环境)
|
|
44
|
+
```bash
|
|
45
|
+
uv tool install bdpan-cli
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 方式 2:即用即走(无需预先安装)
|
|
49
|
+
```bash
|
|
50
|
+
uvx bdpan-cli --help
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 方式 3:传统 pip 安装
|
|
54
|
+
```bash
|
|
55
|
+
pip install bdpan-cli
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 方式 4:跨平台单文件二进制(免 Python 运行时)
|
|
59
|
+
前往 [GitHub Releases](https://github.com/CodingRookie98/bdpan-cli/releases) 直接下载对应平台单文件二进制可执行包,加入 `PATH` 即可运行:
|
|
60
|
+
- `bdpan-linux-amd64`
|
|
61
|
+
- `bdpan-linux-arm64`
|
|
62
|
+
- `bdpan-macos-arm64` (Apple Silicon)
|
|
63
|
+
- `bdpan-macos-x86_64` (Intel)
|
|
64
|
+
- `bdpan-windows-amd64.exe`
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 命令行使用 (CLI)
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# 查看帮助
|
|
72
|
+
bdpan --help
|
|
73
|
+
|
|
74
|
+
# 常用命令
|
|
75
|
+
bdpan ls /影视/电影
|
|
76
|
+
bdpan mkdir /新目录
|
|
77
|
+
bdpan mv <源路径>... <目标目录> # 多源时目标须为已存在目录(自动记录流水)
|
|
78
|
+
bdpan cp <源路径>... <目标目录|目标目录/新名> # 单源支持改名
|
|
79
|
+
bdpan rename <路径> <新名称> # 原地更名(自动记录流水)
|
|
80
|
+
bdpan rm <路径>... [-y]
|
|
81
|
+
bdpan quota [--check-expire] [--check-free] # 网盘容量
|
|
82
|
+
bdpan whoami # 账户信息
|
|
83
|
+
bdpan search <关键词> [--dir 目录] [--no-recursion]
|
|
84
|
+
bdpan tree <路径> [--depth N] [--index 索引.json] # 递归树+本地索引
|
|
85
|
+
bdpan upload <本地文件> <目标目录|目标目录/新名> [--overwrite] # 分片上传+断点续传(首片秒传+动态机房)
|
|
86
|
+
bdpan download <网盘文件>... [--dest 本地目录] [--overwrite] # 大文件断点续传下载
|
|
87
|
+
bdpan dlink <网盘文件>... [--aria2 | --curl] # 提取高速直链或导出下载脚本
|
|
88
|
+
bdpan dedup /影视/电影 --staging-dir /隔离区 # 治理 (1)/(2) 冲突副本
|
|
89
|
+
bdpan scrape foldering /影视/电影/unscraped # 媒体库电影散落文件建目录归集(默认方案 A,支持 --format 模板)
|
|
90
|
+
bdpan scrape preview /影视/电影/待刮削 # 刮削重命名预演(支持 --format 模板,生成对照表)
|
|
91
|
+
bdpan scrape apply preview.csv # 批量应用刮削重命名
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# 安全运维体系与操作撤销 (Safety & Undo)
|
|
95
|
+
bdpan ops list [--limit 20] # 查看关键变更操作流水审计日志
|
|
96
|
+
bdpan ops show <op_id> # 查看某次操作的明细与映射清单
|
|
97
|
+
bdpan undo <op_id> [--dry-run] [-y] # 逆向撤销回滚指定批次操作(支持预演)
|
|
98
|
+
|
|
99
|
+
# 多账号认证与隔离 (Multi-Account Auth)
|
|
100
|
+
bdpan auth list # 查看本地保存的网盘账号及凭证有效性
|
|
101
|
+
bdpan auth switch <alias> # 切换当前默认活跃账号
|
|
102
|
+
bdpan auth login [--account <alias>] # 登录/重新授权指定账号别名
|
|
103
|
+
bdpan --account <alias> <subcommand> # 临时以指定账号执行单次命令(多租户并发隔离)
|
|
104
|
+
|
|
105
|
+
# 媒体可观测性与全局选项 (Media Insights & Global Options)
|
|
106
|
+
bdpan info /影视/电影/Inception.mkv # 探测视频精准分辨率(4K/1080P)、时长、HEVC编码与音轨
|
|
107
|
+
bdpan stats /影视/电影 [--depth N] # 递归聚合统计目录总容量、总文件数及媒体格式分类占比
|
|
108
|
+
bdpan -V / --version # 查看当前 CLI 工具版本号
|
|
109
|
+
bdpan --json <subcommand> # 所有核心查询命令支持标准化 JSON 信封输出(脚本化集成)
|
|
110
|
+
bdpan --debug <subcommand> # 开启详细诊断调试日志(输出至 stderr,双写至 ~/.config/bdpan/logs/)
|
|
111
|
+
bdpan -q <subcommand> # 静音非错误输出(仅保留 ERROR)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
# AI 原生集成 (Model Context Protocol / MCP)
|
|
115
|
+
bdpan mcp # 启动标准 stdio MCP Server,供 Claude Code / Cursor / AI 智能体调用
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
> **操作安全机制**:`mv` / `cp` 遵循严格目标判定;`rm` 默认交互确认,`-y` 跳过;网盘删除由服务端移入回收站。批量操作支持 `--dry-run` 预演;所有破坏性移动更名自动落盘流水审计,支持一键逆向回滚还原。
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## 本地开发环境
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# 克隆仓库
|
|
126
|
+
git clone https://github.com/CodingRookie98/bdpan-cli.git
|
|
127
|
+
cd bdpan-cli
|
|
128
|
+
|
|
129
|
+
# 安装依赖
|
|
130
|
+
uv sync
|
|
131
|
+
|
|
132
|
+
# 本地调试运行
|
|
133
|
+
uv run bdpan --help
|
|
134
|
+
|
|
135
|
+
# 运行全量测试
|
|
136
|
+
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run pytest
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## 应用凭证与用户数据
|
|
140
|
+
|
|
141
|
+
1. 开发者应用密钥:复制模板并填入开放平台应用的 AppKey / AppSecret(`.env` 已被 git 忽略,不会提交):
|
|
142
|
+
```bash
|
|
143
|
+
cp .env.example .env
|
|
144
|
+
```
|
|
145
|
+
2. 用户登录授权凭据:用户首次通过 OAuth 登录授权后,Token 自动保存在 `~/.config/bdpan/tokens.json`(受系统权限 `0o600` 保护)。
|
|
146
|
+
3. 诊断调试日志:完整执行细节自动落盘双写至 `~/.config/bdpan/logs/bdpan.log`。
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 项目结构
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
├── docs/ # 治理文档(Diátaxis 四象限,见 docs/GOVERNANCE.md)
|
|
154
|
+
│ ├── index.md # 知识库总入口
|
|
155
|
+
│ ├── llms.txt # AI 智能体机器地图
|
|
156
|
+
│ ├── project/ # 演进路线图 (roadmap.md)、待办 (backlog.md)、计划 (plans/)
|
|
157
|
+
│ └── reference/api/ # SDK 接口参考(机器真理源)
|
|
158
|
+
├── pyproject.toml # 标准 Python 项目配置与 CLI 命令行入口
|
|
159
|
+
├── src/bdpan_cli/ # 核心业务代码与 CLI 子命令
|
|
160
|
+
│ └── _vendor/ # 内聚内嵌的 OpenAPI Client 依赖包(标准轮子直接打包)
|
|
161
|
+
├── tests/ # 单元测试与回归套件 (180+ 项全绿)
|
|
162
|
+
└── .python-version # 3.12
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## 贡献与开源
|
|
166
|
+
|
|
167
|
+
详细贡献规范、测试门禁与提交信息格式见 [CONTRIBUTING.md](./CONTRIBUTING.md)。开源许可协议遵循 [MIT License](./LICENSE)。
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# bdpan-cli
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://www.python.org/downloads/)
|
|
5
|
+
[](https://github.com/astral-sh/uv)
|
|
6
|
+
|
|
7
|
+
[中文](README.md) | [English](README_en.md)
|
|
8
|
+
|
|
9
|
+
百度网盘工程化 CLI 管理工具。基于[百度网盘开放平台](https://pan.baidu.com/union/doc/)官方 SDK 与协议标准构建,提供文件管理、分片上传续传、冲突副本治理与影视媒体库规范化自动化刮削整理。
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 快速安装 (Installation)
|
|
14
|
+
|
|
15
|
+
### 方式 1:uv tool 安装(推荐,隔离环境)
|
|
16
|
+
```bash
|
|
17
|
+
uv tool install bdpan-cli
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### 方式 2:即用即走(无需预先安装)
|
|
21
|
+
```bash
|
|
22
|
+
uvx bdpan-cli --help
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 方式 3:传统 pip 安装
|
|
26
|
+
```bash
|
|
27
|
+
pip install bdpan-cli
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 方式 4:跨平台单文件二进制(免 Python 运行时)
|
|
31
|
+
前往 [GitHub Releases](https://github.com/CodingRookie98/bdpan-cli/releases) 直接下载对应平台单文件二进制可执行包,加入 `PATH` 即可运行:
|
|
32
|
+
- `bdpan-linux-amd64`
|
|
33
|
+
- `bdpan-linux-arm64`
|
|
34
|
+
- `bdpan-macos-arm64` (Apple Silicon)
|
|
35
|
+
- `bdpan-macos-x86_64` (Intel)
|
|
36
|
+
- `bdpan-windows-amd64.exe`
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 命令行使用 (CLI)
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# 查看帮助
|
|
44
|
+
bdpan --help
|
|
45
|
+
|
|
46
|
+
# 常用命令
|
|
47
|
+
bdpan ls /影视/电影
|
|
48
|
+
bdpan mkdir /新目录
|
|
49
|
+
bdpan mv <源路径>... <目标目录> # 多源时目标须为已存在目录(自动记录流水)
|
|
50
|
+
bdpan cp <源路径>... <目标目录|目标目录/新名> # 单源支持改名
|
|
51
|
+
bdpan rename <路径> <新名称> # 原地更名(自动记录流水)
|
|
52
|
+
bdpan rm <路径>... [-y]
|
|
53
|
+
bdpan quota [--check-expire] [--check-free] # 网盘容量
|
|
54
|
+
bdpan whoami # 账户信息
|
|
55
|
+
bdpan search <关键词> [--dir 目录] [--no-recursion]
|
|
56
|
+
bdpan tree <路径> [--depth N] [--index 索引.json] # 递归树+本地索引
|
|
57
|
+
bdpan upload <本地文件> <目标目录|目标目录/新名> [--overwrite] # 分片上传+断点续传(首片秒传+动态机房)
|
|
58
|
+
bdpan download <网盘文件>... [--dest 本地目录] [--overwrite] # 大文件断点续传下载
|
|
59
|
+
bdpan dlink <网盘文件>... [--aria2 | --curl] # 提取高速直链或导出下载脚本
|
|
60
|
+
bdpan dedup /影视/电影 --staging-dir /隔离区 # 治理 (1)/(2) 冲突副本
|
|
61
|
+
bdpan scrape foldering /影视/电影/unscraped # 媒体库电影散落文件建目录归集(默认方案 A,支持 --format 模板)
|
|
62
|
+
bdpan scrape preview /影视/电影/待刮削 # 刮削重命名预演(支持 --format 模板,生成对照表)
|
|
63
|
+
bdpan scrape apply preview.csv # 批量应用刮削重命名
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# 安全运维体系与操作撤销 (Safety & Undo)
|
|
67
|
+
bdpan ops list [--limit 20] # 查看关键变更操作流水审计日志
|
|
68
|
+
bdpan ops show <op_id> # 查看某次操作的明细与映射清单
|
|
69
|
+
bdpan undo <op_id> [--dry-run] [-y] # 逆向撤销回滚指定批次操作(支持预演)
|
|
70
|
+
|
|
71
|
+
# 多账号认证与隔离 (Multi-Account Auth)
|
|
72
|
+
bdpan auth list # 查看本地保存的网盘账号及凭证有效性
|
|
73
|
+
bdpan auth switch <alias> # 切换当前默认活跃账号
|
|
74
|
+
bdpan auth login [--account <alias>] # 登录/重新授权指定账号别名
|
|
75
|
+
bdpan --account <alias> <subcommand> # 临时以指定账号执行单次命令(多租户并发隔离)
|
|
76
|
+
|
|
77
|
+
# 媒体可观测性与全局选项 (Media Insights & Global Options)
|
|
78
|
+
bdpan info /影视/电影/Inception.mkv # 探测视频精准分辨率(4K/1080P)、时长、HEVC编码与音轨
|
|
79
|
+
bdpan stats /影视/电影 [--depth N] # 递归聚合统计目录总容量、总文件数及媒体格式分类占比
|
|
80
|
+
bdpan -V / --version # 查看当前 CLI 工具版本号
|
|
81
|
+
bdpan --json <subcommand> # 所有核心查询命令支持标准化 JSON 信封输出(脚本化集成)
|
|
82
|
+
bdpan --debug <subcommand> # 开启详细诊断调试日志(输出至 stderr,双写至 ~/.config/bdpan/logs/)
|
|
83
|
+
bdpan -q <subcommand> # 静音非错误输出(仅保留 ERROR)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# AI 原生集成 (Model Context Protocol / MCP)
|
|
87
|
+
bdpan mcp # 启动标准 stdio MCP Server,供 Claude Code / Cursor / AI 智能体调用
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
> **操作安全机制**:`mv` / `cp` 遵循严格目标判定;`rm` 默认交互确认,`-y` 跳过;网盘删除由服务端移入回收站。批量操作支持 `--dry-run` 预演;所有破坏性移动更名自动落盘流水审计,支持一键逆向回滚还原。
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## 本地开发环境
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# 克隆仓库
|
|
98
|
+
git clone https://github.com/CodingRookie98/bdpan-cli.git
|
|
99
|
+
cd bdpan-cli
|
|
100
|
+
|
|
101
|
+
# 安装依赖
|
|
102
|
+
uv sync
|
|
103
|
+
|
|
104
|
+
# 本地调试运行
|
|
105
|
+
uv run bdpan --help
|
|
106
|
+
|
|
107
|
+
# 运行全量测试
|
|
108
|
+
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run pytest
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## 应用凭证与用户数据
|
|
112
|
+
|
|
113
|
+
1. 开发者应用密钥:复制模板并填入开放平台应用的 AppKey / AppSecret(`.env` 已被 git 忽略,不会提交):
|
|
114
|
+
```bash
|
|
115
|
+
cp .env.example .env
|
|
116
|
+
```
|
|
117
|
+
2. 用户登录授权凭据:用户首次通过 OAuth 登录授权后,Token 自动保存在 `~/.config/bdpan/tokens.json`(受系统权限 `0o600` 保护)。
|
|
118
|
+
3. 诊断调试日志:完整执行细节自动落盘双写至 `~/.config/bdpan/logs/bdpan.log`。
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## 项目结构
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
├── docs/ # 治理文档(Diátaxis 四象限,见 docs/GOVERNANCE.md)
|
|
126
|
+
│ ├── index.md # 知识库总入口
|
|
127
|
+
│ ├── llms.txt # AI 智能体机器地图
|
|
128
|
+
│ ├── project/ # 演进路线图 (roadmap.md)、待办 (backlog.md)、计划 (plans/)
|
|
129
|
+
│ └── reference/api/ # SDK 接口参考(机器真理源)
|
|
130
|
+
├── pyproject.toml # 标准 Python 项目配置与 CLI 命令行入口
|
|
131
|
+
├── src/bdpan_cli/ # 核心业务代码与 CLI 子命令
|
|
132
|
+
│ └── _vendor/ # 内聚内嵌的 OpenAPI Client 依赖包(标准轮子直接打包)
|
|
133
|
+
├── tests/ # 单元测试与回归套件 (180+ 项全绿)
|
|
134
|
+
└── .python-version # 3.12
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## 贡献与开源
|
|
138
|
+
|
|
139
|
+
详细贡献规范、测试门禁与提交信息格式见 [CONTRIBUTING.md](./CONTRIBUTING.md)。开源许可协议遵循 [MIT License](./LICENSE)。
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "bdpan-cli"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "百度网盘工程化 CLI 管理工具"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"python-dotenv>=1.2.3",
|
|
9
|
+
"urllib3>=1.25.3",
|
|
10
|
+
"python-dateutil>=2.9.0.post0",
|
|
11
|
+
]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 4 - Beta",
|
|
14
|
+
"Environment :: Console",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"Intended Audience :: End Users/Desktop",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.12",
|
|
20
|
+
"Programming Language :: Python :: 3.13",
|
|
21
|
+
"Programming Language :: Python :: 3.14",
|
|
22
|
+
"Topic :: System :: Archiving",
|
|
23
|
+
"Topic :: Utilities",
|
|
24
|
+
]
|
|
25
|
+
keywords = [
|
|
26
|
+
"baidu-pan",
|
|
27
|
+
"netdisk",
|
|
28
|
+
"cli",
|
|
29
|
+
"scraper",
|
|
30
|
+
"backup",
|
|
31
|
+
"cloud-storage",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.license]
|
|
35
|
+
text = "MIT"
|
|
36
|
+
|
|
37
|
+
[[project.authors]]
|
|
38
|
+
name = "CodingRookie98"
|
|
39
|
+
email = "520whjoker@gmail.com"
|
|
40
|
+
|
|
41
|
+
[project.urls]
|
|
42
|
+
Homepage = "https://github.com/CodingRookie98/bdpan-cli"
|
|
43
|
+
Repository = "https://github.com/CodingRookie98/bdpan-cli"
|
|
44
|
+
Documentation = "https://github.com/CodingRookie98/bdpan-cli#readme"
|
|
45
|
+
|
|
46
|
+
[project.scripts]
|
|
47
|
+
bdpan = "bdpan_cli.cli:main"
|
|
48
|
+
bdpan-cli = "bdpan_cli.cli:main"
|
|
49
|
+
bd-net-disc-mgr = "bdpan_cli.cli:main"
|
|
50
|
+
|
|
51
|
+
[build-system]
|
|
52
|
+
requires = ["uv_build>=0.12.12,<0.14.0"]
|
|
53
|
+
build-backend = "uv_build"
|
|
54
|
+
|
|
55
|
+
[dependency-groups]
|
|
56
|
+
dev = [
|
|
57
|
+
"pytest>=9.1.1",
|
|
58
|
+
"pyinstaller>=6.10.0",
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
[tool.pytest.ini_options]
|
|
62
|
+
testpaths = ["tests"]
|
|
63
|
+
addopts = "-p no:ament_copyright -p no:ament_flake8 -p no:ament_pep257 -p no:ament_lint -p no:launch_testing -p no:launch_testing_ros -p no:launch_testing_ros_pytest_entrypoint"
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "bdpan-cli"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "百度网盘工程化 CLI 管理工具"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = { text = "MIT" }
|
|
7
|
+
authors = [
|
|
8
|
+
{ name = "CodingRookie98", email = "520whjoker@gmail.com" }
|
|
9
|
+
]
|
|
10
|
+
requires-python = ">=3.12"
|
|
11
|
+
dependencies = [
|
|
12
|
+
"python-dotenv>=1.2.3",
|
|
13
|
+
"urllib3>=1.25.3",
|
|
14
|
+
"python-dateutil>=2.9.0.post0",
|
|
15
|
+
]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Environment :: Console",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Intended Audience :: End Users/Desktop",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Programming Language :: Python :: 3.14",
|
|
26
|
+
"Topic :: System :: Archiving",
|
|
27
|
+
"Topic :: Utilities",
|
|
28
|
+
]
|
|
29
|
+
keywords = ["baidu-pan", "netdisk", "cli", "scraper", "backup", "cloud-storage"]
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://github.com/CodingRookie98/bdpan-cli"
|
|
33
|
+
Repository = "https://github.com/CodingRookie98/bdpan-cli"
|
|
34
|
+
Documentation = "https://github.com/CodingRookie98/bdpan-cli#readme"
|
|
35
|
+
|
|
36
|
+
[project.scripts]
|
|
37
|
+
bdpan = "bdpan_cli.cli:main"
|
|
38
|
+
bdpan-cli = "bdpan_cli.cli:main"
|
|
39
|
+
bd-net-disc-mgr = "bdpan_cli.cli:main"
|
|
40
|
+
|
|
41
|
+
[build-system]
|
|
42
|
+
requires = ["uv_build>=0.12.12,<0.14.0"]
|
|
43
|
+
build-backend = "uv_build"
|
|
44
|
+
|
|
45
|
+
[dependency-groups]
|
|
46
|
+
dev = [
|
|
47
|
+
"pytest>=9.1.1",
|
|
48
|
+
"pyinstaller>=6.10.0",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
[tool.pytest.ini_options]
|
|
52
|
+
testpaths = ["tests"]
|
|
53
|
+
addopts = "-p no:ament_copyright -p no:ament_flake8 -p no:ament_pep257 -p no:ament_lint -p no:launch_testing -p no:launch_testing_ros -p no:launch_testing_ros_pytest_entrypoint"
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""命令行入口:列出网盘目录。"""
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
from bdpan_cli._vendor import openapi_client
|
|
6
|
+
from bdpan_cli._vendor.openapi_client.api.fileinfo_api import FileinfoApi
|
|
7
|
+
from bdpan_cli._vendor.openapi_client.rest import ApiException
|
|
8
|
+
|
|
9
|
+
from bdpan_cli.auth import TokenManager
|
|
10
|
+
from bdpan_cli.config import load_config
|
|
11
|
+
from bdpan_cli._version import __version__
|
|
12
|
+
|
|
13
|
+
from bdpan_cli.cli import main
|
|
14
|
+
|
|
15
|
+
__all__ = ["main", "__version__"]
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""Vendor dependencies namespace for bdpan_cli.
|
|
2
|
+
|
|
3
|
+
This package vendors the Baidu Netdisk OpenAPI Client to allow standard
|
|
4
|
+
PyPI / Wheel packaging without local relative directory dependencies.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from . import openapi_client
|
|
8
|
+
|
|
9
|
+
__all__ = ["openapi_client"]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# flake8: noqa
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
xpan
|
|
5
|
+
|
|
6
|
+
xpanapi # noqa: E501
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1
|
|
9
|
+
Generated by: https://openapi-generator.tech
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
__version__ = "1.0.0"
|
|
14
|
+
|
|
15
|
+
# import ApiClient
|
|
16
|
+
from bdpan_cli._vendor.openapi_client.api_client import ApiClient
|
|
17
|
+
|
|
18
|
+
# import Configuration
|
|
19
|
+
from bdpan_cli._vendor.openapi_client.configuration import Configuration
|
|
20
|
+
|
|
21
|
+
# import exceptions
|
|
22
|
+
from bdpan_cli._vendor.openapi_client.exceptions import OpenApiException
|
|
23
|
+
from bdpan_cli._vendor.openapi_client.exceptions import ApiAttributeError
|
|
24
|
+
from bdpan_cli._vendor.openapi_client.exceptions import ApiTypeError
|
|
25
|
+
from bdpan_cli._vendor.openapi_client.exceptions import ApiValueError
|
|
26
|
+
from bdpan_cli._vendor.openapi_client.exceptions import ApiKeyError
|
|
27
|
+
from bdpan_cli._vendor.openapi_client.exceptions import ApiException
|