Skip to content

Commit

Permalink
Merge pull request #199 from Ljzd-PRO/devel
Browse files Browse the repository at this point in the history
Bump to v0.11.1
  • Loading branch information
Ljzd-PRO authored Dec 3, 2024
2 parents cf5c12c + 0bc547b commit 4e15e61
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 145 deletions.
21 changes: 7 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
## Changes

### 💡 Feature
[//]: # (### 💡 Feature)

- The `search-creator` command will include search results with similar names.
- For example, the search parameter `--name abc` might return author information such as: `abc, abcd, hi-abc`
- Share an HTTPX client to reuse underlying TCP connections through an HTTP connection pool when calling APIs and downloading,
**significantly improving query and download speeds as well as connection stability**
### 🪲 Fix

[//]: # (### 🪲 Fix)
- Update the API for retrieving post information and fix the `get-post` and `download-post` commands (#198) (#180)

- - -
[//]: # (### 💡 新特性)

### 💡 新特性
### 🪲 修复

- search-creator 搜索作者的命令将包含那些名字相近的搜索结果
- 如搜索参数 `--name abc` 可能得到如下作者信息:`abc, abcd, hi-abc`
- 共享 HTTPX 客户端,调用 API 和下载时将通过 HTTP 连接池重用底层 TCP 连接,**显著提升查询、下载速度和连接稳定性**
- 更新获取作品信息的 API,修复 `get-post``download-post` 命令 (#198) (#180)

[//]: # (### 🪲 修复)

**Full Changelog**: https://github.com/Ljzd-PRO/KToolBox/compare/v0.10.0...v0.11.0
**Full Changelog**: https://github.com/Ljzd-PRO/KToolBox/compare/v0.11.0...v0.11.1
2 changes: 1 addition & 1 deletion ktoolbox/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__title__ = "KToolBox"
# noinspection SpellCheckingInspection
__description__ = "A useful CLI tool for downloading posts in Kemono.party / .su"
__version__ = "v0.11.0"
__version__ = "v0.11.1"
8 changes: 5 additions & 3 deletions ktoolbox/api/posts/get_post.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pydantic import BaseModel

from ktoolbox.api import BaseAPI, APIRet
from ktoolbox.api.model import Post

Expand All @@ -8,11 +10,11 @@ class GetPost(BaseAPI):
path = "/{service}/user/{creator_id}/post/{post_id}"
method = "get"

class Response(Post):
...
class Response(BaseModel):
post: Post

@classmethod
async def __call__(cls, service: str, creator_id: str, post_id: str) -> APIRet[Post]:
async def __call__(cls, service: str, creator_id: str, post_id: str) -> APIRet[Response]:
"""
Get a specific post
Expand Down
8 changes: 4 additions & 4 deletions ktoolbox/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ async def get_post(service: str, creator_id: str, post_id: str, *, dump: Path =
if dump:
async with aiofiles.open(str(dump), "w", encoding="utf-8") as f:
await f.write(
ret.data.model_dump_json(indent=config.json_dump_indent)
ret.data.post.model_dump_json(indent=config.json_dump_indent)
)
return ret.data
return ret.data.post
else:
return ret.message

Expand Down Expand Up @@ -201,9 +201,9 @@ async def download_post(
post_id=post_id
)
if ret:
post_path = path / generate_post_path_name(ret.data)
post_path = path / generate_post_path_name(ret.data.post)
job_list = await create_job_from_post(
post=ret.data,
post=ret.data.post,
post_path=post_path,
dump_post_data=dump_post_data
)
Expand Down
Loading

0 comments on commit 4e15e61

Please sign in to comment.