Skip to content

Commit 492d446

Browse files
authored
Merge pull request #173 from Ljzd-PRO/devel
Bump to v0.9.0
2 parents 0183910 + 0a74df5 commit 492d446

28 files changed

+1651
-681
lines changed

prod.env renamed to .env

File renamed without changes.

.github/actions/pyinstaller/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ runs:
2020
shell: bash
2121

2222
- name: Copy Extra Files
23-
run: cp README.md README_zh-CN.md example.env prod.env LICENSE dist
23+
run: cp README.md README_zh-CN.md example.env .env LICENSE dist
2424
shell: bash

.github/actions/setup-python/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ runs:
2020
architecture: "x64"
2121
cache: "poetry"
2222

23-
- run: poetry install --with test,docs,pyinstaller
23+
- run: poetry install --with test,docs,pyinstaller --extras urwid
2424
shell: bash

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ celerybeat.pid
120120
*.sage.py
121121

122122
# Environments
123-
.env
123+
# .env
124124
.venv
125125
env/
126126
venv/

CHANGELOG.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,24 @@
22

33
### 💡 Feature
44

5-
- Show the download job status each 30s (waiting, running, completed%)
6-
- Shortened the log length
7-
- E.g. `2024-10-05 20:12:37 | WARNING | ktoolbox.job.runner - Download file already exists, skipping ...`
5+
- Added a **graphical configuration editor**, making configuration editing simple and convenient.
6+
- Run `ktoolbox config-editor`
7+
- Added a command to generate a complete sample configuration file.
8+
- Run `ktoolbox example-env`
9+
- **Python** versions below 3.8.1 (**<3.8.1**) are no longer supported
810

9-
### 🪲 Fix
10-
11-
- Fix error when attempting to download files which posses too long names (invalid names) (#150)
12-
- For example the wrong filename like this: `https://www.patreon.com/media-u/Z0FBQUFBQm........=#12345678_` \
13-
KToolBox can get the correct filename: `6edd5bdae......0e7f913.png`
11+
[//]: # (### 🪲 Fix)
1412

1513
- - -
1614

1715
### 💡 新特性
1816

19-
- 每隔 30 秒显示下载任务状态(等待中、运行中、已完成%)
20-
- 缩短了日志长度
21-
- 例如 `2024-10-05 20:12:37 | WARNING | ktoolbox.job.runner - Download file already exists, skipping ...`
22-
23-
### 🪲 修复
17+
- 新增 **图形化配置编辑器**,配置编辑将变得简单方便
18+
- 运行 `ktoolbox config-editor`
19+
- 新增命令可生成完整的配置文件样例
20+
- 运行 `ktoolbox example-env`
21+
- **Python** 3.8.1 以下 (**<3.8.1**) 的版本不再受支持
2422

25-
- 修复下载过长文件名(非法文件名)的文件时报错的问题 (#150)
26-
- 例如这样的错误文件名:`https://www.patreon.com/media-u/Z0FBQUFBQm........=#12345678_` \
27-
KToolBox 可以获取到正确的文件名:`6edd5bdae......0e7f913.png`
23+
[//]: # (### 🪲 修复)
2824

29-
**Full Changelog**: https://github.com/Ljzd-PRO/KToolBox/compare/v0.8.0...v0.9.0
25+
**Full Changelog**: https://github.com/Ljzd-PRO/KToolBox/compare/v0.9.0...v0.10.0

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ Goto [Shortcuts for iOS](https://ktoolbox.readthedocs.io/latest/shortcut/) page
130130

131131
Goto [Configuration-Guide](https://ktoolbox.readthedocs.io/latest/configuration/guide/) page for more details.
132132

133+
![KToolBox Configuration Editor](https://cdn.jsdelivr.net/gh/Ljzd-PRO/KToolBox@latest/static/preview-2.png)
134+
![KToolBox Configuration Editor](https://cdn.jsdelivr.net/gh/Ljzd-PRO/KToolBox@latest/static/preview-3.png)
135+
133136
## Other Branches
134137

135138
- Pure Python branch: [🔗pure-py](https://github.com/Ljzd-PRO/KToolBox/tree/pure-py)

README_zh-CN.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ ktoolbox sync-creator https://kemono.su/fanbox/user/9016 --start-time=2024-1-1 -
130130

131131
前往 [配置-向导](https://ktoolbox.readthedocs.io/latest/zh/configuration/guide/) 页面查看更多详情。
132132

133+
![KToolBox 配置编辑器](https://cdn.jsdelivr.net/gh/Ljzd-PRO/KToolBox@latest/static/preview-2.png)
134+
![KToolBox 配置编辑器](https://cdn.jsdelivr.net/gh/Ljzd-PRO/KToolBox@latest/static/preview-3.png)
135+
133136
## 其他分支
134137

135138
- 纯 Python 分支:[🔗pure-py](https://github.com/Ljzd-PRO/KToolBox/tree/pure-py)

SECURITY.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
| 3.11.x | :white_check_mark: |
99
| 3.10.x | :white_check_mark: |
1010
| 3.9.x | :white_check_mark: |
11-
| 3.8.x | :white_check_mark: |
12-
| <= 3.7 | :x: |
11+
| < 3.8.1 | :x: |
1312

1413
## Reporting a Vulnerability
1514

docs/en/commands/guide.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,22 @@ ktoolbox -h
1818
ktoolbox download-post -h
1919
```
2020

21+
## Launch the graphical configuration editor
22+
23+
`config-editor`
24+
25+
```bash
26+
ktoolbox config-editor
27+
```
28+
29+
## Generate an example configuration file (`.env`/`prod.env`)
30+
31+
`example-env`
32+
33+
```bash
34+
ktoolbox example-env
35+
```
36+
2137
## Download a specific post
2238

2339
`download-post`

docs/en/configuration/guide.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
# Guide
22

3-
- KToolBox read **`.env` or `prod.env` file** in the work folder or **environment variables** to store configuration
3+
!!! tip "Graphical Configuration Editor"
4+
5+
=== "Usage"
6+
7+
Run `ktoolbox config-editor` to launch,
8+
it will make configuration editing simple and convenient.
9+
10+
- Press `<Esc>` for back, `<Enter>` for select
11+
- You can also use the GUI with the mouse
12+
13+
=== "Screenshot"
14+
15+
![KToolBox Configuration Editor](https://cdn.jsdelivr.net/gh/Ljzd-PRO/KToolBox@latest/static/preview-2.png){ loading=lazy }
16+
![KToolBox Configuration Editor](https://cdn.jsdelivr.net/gh/Ljzd-PRO/KToolBox@latest/static/preview-3.png){ loading=lazy }
17+
18+
!!! tip "Generate Example `.env` File"
19+
20+
Run `ktoolbox example-env` to generate a complete sample configuration file.
21+
22+
- KToolBox load **`.env` or `prod.env` file** in the **working directory** or **environment variables** to store configuration
423
- Check [Reference](reference.md) for all configuration options
524
- Use `__` to specify the sub option, like `KTOOLBOX_API__SCHEME` means `api.scheme`
625
- All configuration options are optional

docs/en/faq.md

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,71 @@ KTOOLBOX_JOB__SEQUENTIAL_FILENAME=True
4545
4646
# Set the post directory name to its release/publish date and ID, e.g. `[2024-1-1]11223344`
4747
KTOOLBOX_JOB__POST_DIRNAME_FORMAT=[{published}]{id}
48-
```
48+
```
49+
50+
## How to Configure a Proxy?
51+
52+
You can set the `HTTPS_PROXY`, `HTTP_PROXY`, and `ALL_PROXY` environment variables to achieve this.
53+
54+
Refer to: [HTTPX - Environment Variables](https://www.python-httpx.org/environment_variables/#http_proxy-https_proxy-all_proxy)
55+
56+
For example, set it like this:
57+
58+
```shell
59+
# Unix Shell
60+
export HTTPS_PROXY=http://127.0.0.1:7897
61+
export HTTP_PROXY=http://127.0.0.1:7897
62+
export ALL_PROXY=socks5://127.0.0.1:7897
63+
```
64+
65+
```powershell
66+
# Windows PowerShell
67+
$env:HTTP_PROXY="http://127.0.0.1:7897"; $env:HTTPS_PROXY="http://127.0.0.1:7897"
68+
```
69+
70+
## GUI Configuration Editor Cannot Be Opened
71+
72+
!!! warning "Note"
73+
[`ktoolbox-pure-py`](https://pypi.org/project/ktoolbox-pure-py/) does not support the graphical configuration editor.
74+
75+
By default, the dependencies for the graphical configuration editor are not installed. You can install them using the following command:
76+
77+
```shell
78+
pip3 install ktoolbox[urwid]
79+
```
80+
81+
If you are using pipx:
82+
83+
```shell
84+
pipx install ktoolbox[urwid] --force
85+
```
86+
87+
## Kemono API Call Failed
88+
89+
For example:
90+
91+
```
92+
ktoolbox sync-creator "https://coomer.su/onlyfans/user/hollyharper11" --start-time="2020-05-01" --end-time="2025-01-01"
93+
94+
2024-05-12 12:52:51.477 | INFO | ktoolbox.cli:sync_creator:271 - Got creator information - {'name': 'hollyharper11', 'id': 'hollyharper11'}
95+
2024-05-12 12:52:51.479 | INFO | ktoolbox.action.job:create_job_from_creator:148 - Start fetching posts from creator hollyharper11
96+
2024-05-12 12:52:56.477 | ERROR | ktoolbox.api.base:_retry_error_callback:37 - Kemono API call failed - {'ret': APIRet(code=1002, message="1 validation error for Response\n Invalid JSON: expected value at line 1 column 1 [type=json_invalid, input_value='<!DOCTYPE html>\\n<html>\\...>\\n </body>\\n</html>\\n', input_type=str]\n For further information visit https://errors.pydantic.dev/2.7/v/json_invalid", exception=1 validation error for Response
97+
Invalid JSON: expected value at line 1 column 1 [type=json_invalid, input_value='<!DOCTYPE html>\n<html>\...>\n </body>\n</html>\n', input_type=str]
98+
For further information visit https://errors.pydantic.dev/2.7/v/json_invalid, data=None)}
99+
1 validation error for Response
100+
Invalid JSON: expected value at line 1 column 1 [type=json_invalid, input_value='<!DOCTYPE html>\n<html>\...>\n </body>\n</html>\n', input_type=str]
101+
For further information visit https://errors.pydantic.dev/2.7/v/json_invalid
102+
```
103+
104+
This is generally caused by frequent requests, so you can try setting a higher number of API retry attempts.
105+
106+
```dotenv
107+
# .env / prod.env
108+
KTOOLBOX_API__RETRY_TIMES=10
109+
```
110+
111+
You can also set this through the graphical configuration editor: API - retry_times.
112+
113+
## Others
114+
115+
A community-shared usage guide: [#141](https://github.com/Ljzd-PRO/KToolBox/issues/141)

docs/en/index.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@
3737
</a>
3838
</p>
3939

40-
<img src="https://cdn.jsdelivr.net/gh/Ljzd-PRO/KToolBox@latest/static/preview-1.png" alt="Preview">
41-
4240
## Features
4341

4442
- Support for **multi-thread** downloads (technically, coroutine)

docs/zh/commands/guide.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,22 @@ ktoolbox -h
1818
ktoolbox download-post -h
1919
```
2020

21+
## 启动图形化配置编辑器
22+
23+
`config-editor`
24+
25+
```bash
26+
ktoolbox config-editor
27+
```
28+
29+
## 生成一个配置文件样例 (`.env`/`prod.env`)
30+
31+
`example-env`
32+
33+
```bash
34+
ktoolbox example-env
35+
```
36+
2137
## 下载指定的作品
2238

2339
`download-post`

docs/zh/configuration/guide.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
# 向导
22

3-
- KToolBox 读取工作目录下的 **`.env``prod.env` 文件****环境变量** 来设定配置
3+
!!! tip "图形化配置编辑器"
4+
5+
=== "用法"
6+
7+
运行 `ktoolbox config-editor` 来启动,这会使配置编辑变得简单方便。
8+
9+
- 按下 `<Esc>` 来返回,按 `<Enter>` 来选择
10+
- 你也可以通过鼠标使用这个 GUI
11+
12+
=== "截图"
13+
14+
![KToolBox 配置编辑器](https://cdn.jsdelivr.net/gh/Ljzd-PRO/KToolBox@latest/static/preview-2.png){ loading=lazy }
15+
![KToolBox 配置编辑器](https://cdn.jsdelivr.net/gh/Ljzd-PRO/KToolBox@latest/static/preview-3.png){ loading=lazy }
16+
17+
!!! tip "生成示例 `.env` 文件"
18+
19+
运行 `ktoolbox example-env` 来生成完整的配置文件样例。
20+
21+
- KToolBox 读取 **工作目录** 下的 **`.env``prod.env` 文件****环境变量** 来设定配置
422
- 前往 [参考](./reference.md) 查看所有配置选项
523
-`__` 来指定子选项, 例如 `KTOOLBOX_API__SCHEME` 相当于 `api.scheme`
624
- 所有配置选项都是可选的

docs/zh/faq.md

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,71 @@ KTOOLBOX_JOB__SEQUENTIAL_FILENAME=True
4242
4343
# 设置作品目录名为其发布日期和ID,例如 `[2024-1-1]11223344`
4444
KTOOLBOX_JOB__POST_DIRNAME_FORMAT=[{published}]{id}
45-
```
45+
```
46+
47+
## 如何配置代理?
48+
49+
可以通过设置 `HTTPS_PROXY`, `HTTP_PROXY`, `ALL_PROXY` 环境变量实现
50+
51+
参考:[HTTPX - Environment Variables](https://www.python-httpx.org/environment_variables/#http_proxy-https_proxy-all_proxy)
52+
53+
例如这样设置:
54+
55+
```shell
56+
# Unix Shell
57+
export HTTPS_PROXY=http://127.0.0.1:7897
58+
export HTTP_PROXY=http://127.0.0.1:7897
59+
export ALL_PROXY=socks5://127.0.0.1:7897
60+
```
61+
62+
```powershell
63+
# Windows PowerShell
64+
$env:HTTP_PROXY="http://127.0.0.1:7897"; $env:HTTPS_PROXY="http://127.0.0.1:7897"
65+
```
66+
67+
## 图形化配置编辑器无法打开
68+
69+
!!! warning "注意"
70+
[`ktoolbox-pure-py`](https://pypi.org/project/ktoolbox-pure-py/) 不支持图形化配置编辑器
71+
72+
默认情况下,图形化配置编辑器的相关依赖不会被安装,可使用以下命令附带安装:
73+
74+
```shell
75+
pip3 install ktoolbox[urwid]
76+
```
77+
78+
如果你用的是 pipx:
79+
80+
```shell
81+
pipx install ktoolbox[urwid] --force
82+
```
83+
84+
## Kemono API 调用失败
85+
86+
例如:
87+
88+
```
89+
ktoolbox sync-creator "https://coomer.su/onlyfans/user/hollyharper11" --start-time="2020-05-01" --end-time="2025-01-01"
90+
91+
2024-05-12 12:52:51.477 | INFO | ktoolbox.cli:sync_creator:271 - Got creator information - {'name': 'hollyharper11', 'id': 'hollyharper11'}
92+
2024-05-12 12:52:51.479 | INFO | ktoolbox.action.job:create_job_from_creator:148 - Start fetching posts from creator hollyharper11
93+
2024-05-12 12:52:56.477 | ERROR | ktoolbox.api.base:_retry_error_callback:37 - Kemono API call failed - {'ret': APIRet(code=1002, message="1 validation error for Response\n Invalid JSON: expected value at line 1 column 1 [type=json_invalid, input_value='<!DOCTYPE html>\\n<html>\\...>\\n </body>\\n</html>\\n', input_type=str]\n For further information visit https://errors.pydantic.dev/2.7/v/json_invalid", exception=1 validation error for Response
94+
Invalid JSON: expected value at line 1 column 1 [type=json_invalid, input_value='<!DOCTYPE html>\n<html>\...>\n </body>\n</html>\n', input_type=str]
95+
For further information visit https://errors.pydantic.dev/2.7/v/json_invalid, data=None)}
96+
1 validation error for Response
97+
Invalid JSON: expected value at line 1 column 1 [type=json_invalid, input_value='<!DOCTYPE html>\n<html>\...>\n </body>\n</html>\n', input_type=str]
98+
For further information visit https://errors.pydantic.dev/2.7/v/json_invalid
99+
```
100+
101+
一般可能是因为请求频繁导致,你可以尝试设置更多的 API 重试次数
102+
103+
```dotenv
104+
# .env / prod.env
105+
KTOOLBOX_API__RETRY_TIMES=10
106+
```
107+
108+
你也可以通过图形化配置编辑器设置:API - retry_times
109+
110+
## 其他
111+
112+
一个社区分享的使用向导:[#141](https://github.com/Ljzd-PRO/KToolBox/issues/141)

docs/zh/index.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@
3838
</a>
3939
</p>
4040

41-
<img src="https://cdn.jsdelivr.net/gh/Ljzd-PRO/KToolBox@latest/static/preview-1.png" alt="Preview">
42-
4341
## 功能
4442

4543
- 支持 **多线程** 下载(技术上是协程)

example.env

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
##############################################################################
2+
# It is recommended to use the graphical configuration editor for editing. #
3+
# Run `ktoolbox config-editor` to launch it. #
4+
##############################################################################
5+
16
# Download 10 files at the same time.
27
KTOOLBOX_JOB__COUNT=10
38

@@ -13,14 +18,7 @@ KTOOLBOX_JOB__SEQUENTIAL_FILENAME=True
1318
# For example: `{title}_{}` > `HelloWorld_b4b41de2-8736-480d-b5c3-ebf0d917561b`, etc.
1419
# You can also use it with `sequential_filename`. For instance,
1520
# `[{published}]_{}` > `[2024-1-1]_1.png`, `[2024-1-1]_2.png`, etc.
16-
KTOOLBOX_JOB__FILENAME_FORMAT=[{published}]_{}
21+
KTOOLBOX_JOB__FILENAME_FORMAT=[{published}]_{title}_{id}_{}
1722

1823
# Prefix the post directory name with its release/publish date, e.g. `[2024-1-1]HelloWorld`
1924
KTOOLBOX_JOB__POST_DIRNAME_FORMAT=[{published}]{title}
20-
21-
# Allocate 102400 Bytes as buffer for each download job
22-
KTOOLBOX_DOWNLOADER__BUFFER_SIZE=102400
23-
24-
# Disable SSL certificate verification for Kemono API server and download server
25-
# It's useful when certificate on Kemono server expired. (SSL: CERTIFICATE_VERIFY_FAILED)
26-
KTOOLBOX_SSL_VERIFY=False

0 commit comments

Comments
 (0)