Skip to content

Commit

Permalink
v2.4.1: 实现获取收藏夹内容,优化类和函数的命名
Browse files Browse the repository at this point in the history
  • Loading branch information
hect0x7 committed Nov 15, 2023
1 parent 0339861 commit e0d643d
Show file tree
Hide file tree
Showing 17 changed files with 556 additions and 283 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ $ jmcomic 422866
- **支持Plugin插件,可以方便地扩展功能,以及使用别人的插件**
- 目前内置支持的插件有:`登录插件` `硬件占用监控插件` `只下载新章插件` `压缩文件插件` `下载特定后缀图片插件` `发送QQ邮件插件` `日志主题过滤插件` `自动使用浏览器cookies插件`
- 支持自定义本子/章节/图片下载前后的回调函数
- 支持自定义debug/logging
- 支持自定义日志
- 支持自定义类:`Downloader(负责调度)` `Option(负责配置)` `Client(负责请求)` `实体类`

## 进阶使用
Expand Down
3 changes: 2 additions & 1 deletion assets/docs/sources/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

| 版本范围 | 更新内容 |
|:--------:|:--------------------------------------:|
| v2.3.* | 实现移动端API的基础功能,统一HTML和API的实现 |
| v2.4.* | 项目实现基本稳定,进入维护期,按需增加功能。 |
| v2.3.* | 实现移动端API的基础功能,统一HTML和API的实现。 |
| v2.2.* | 新的插件体系,新的命令行调用,完善搜索功能。 |
| v2.1.* | 拆分Downloader抽象调度,优化可扩展性、代码复用性、模块级别自定义。 |
| v2.0.* | 重新设计合理的抽象层次,实现请求重试切换域名机制,新的option配置设计。 |
Expand Down
4 changes: 2 additions & 2 deletions assets/docs/sources/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ Python API for JMComic(禁漫天堂)

- Supports Plugin for easy functionality extension and use of other plugins.
- Currently built-in
plugins: `login plugin`, `hardware usage monitoring plugin`, `only download new chapters plugin`, `zip compression plugin`, `image suffix filter plugin` `send qq email plugin` `debug logging topic filter plugin` `auto set browser cookies plugin`.
plugins: `login plugin`, `hardware usage monitoring plugin`, `only download new chapters plugin`, `zip compression plugin`, `image suffix filter plugin` `send qq email plugin` `logging topic filter plugin` `auto set browser cookies plugin`.
- Supports custom callback functions before and after downloading album/chapter/images.
- Supports custom debug logging.
- Supports custom logging.
- Supports custom core
classes: `Downloader (responsible for scheduling)`, `Option (responsible for configuration)`, `Client (responsible for requests)`, `entity classes`,
and more.
Expand Down
26 changes: 13 additions & 13 deletions assets/docs/sources/tutorial/4_module_custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,27 +140,27 @@ def custom_album_photo_image_detail_class():



## 自定义debug
## 自定义log

```python
def custom_jm_debug():
def custom_jm_log():
"""
该函数演示自定义debug
该函数演示自定义log
"""

# jmcomic模块在运行过程中会使用 jm_debug() 这个函数进行打印信息
# jm_debug() 这个函数 最后会调用 JmModuleConfig.debug_executor 函数
# 你可以写一个自己的函数,替换 JmModuleConfig.debug_executor,实现自定义debug
# jmcomic模块在运行过程中会使用 jm_log() 这个函数进行打印信息
# jm_log() 这个函数 最后会调用 JmModuleConfig.log_executor 函数
# 你可以写一个自己的函数,替换 JmModuleConfig.log_executor,实现自定义log

# 1. 自定义debug函数
def my_debug(topic: str, msg: str):
# 1. 自定义log函数
def my_log(topic: str, msg: str):
"""
这个debug函数的参数列表必须包含两个参数,topic和msg
@param topic: debug主题,例如 'album.before', 'req.error', 'plugin.error'
@param msg: 具体debug的信息
这个log函数的参数列表必须包含两个参数,topic和msg
@param topic: log主题,例如 'album.before', 'req.error', 'plugin.error'
@param msg: 具体log的信息
"""
pass

# 2. 让my_debug生效
JmModuleConfig.debug_executor = my_debug
# 2. 让my_log生效
JmModuleConfig.log_executor = my_log
```
2 changes: 1 addition & 1 deletion assets/docs/sources/tutorial/8_pick_domain.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ meta_data = {
# 'proxies': ProxyBuilder.clash_proxy()
}

disable_jm_debug()
disable_jm_log()


def get_domain_ls():
Expand Down
2 changes: 1 addition & 1 deletion src/jmcomic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# 被依赖方 <--- 使用方
# config <--- entity <--- toolkit <--- client <--- option <--- downloader

__version__ = '2.3.17'
__version__ = '2.4.1'

from .api import *
from .jm_plugin import *
Expand Down
4 changes: 2 additions & 2 deletions src/jmcomic/cl.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def parse(text):

def main(self):
self.parse_arg()
from .api import jm_debug
jm_debug('command_line',
from .api import jm_log
jm_log('command_line',
f'start downloading...\n'
f'- using option: [{self.option_path or "default"}]\n'
f'to be downloaded: \n'
Expand Down
Loading

0 comments on commit e0d643d

Please sign in to comment.