Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #175

Closed
wants to merge 4 commits into from
Closed

Dev #175

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/close_specific_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
paths:
- 'usage/workflow_download.py'
branches-ignore: [dev, ]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The branches-ignore entry has a trailing comma which is not necessary and could potentially cause issues with YAML parsing. It's best to remove it to avoid any ambiguity.

-    branches-ignore: [dev, ]
+    branches-ignore: [dev]

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
branches-ignore: [dev, ]
branches-ignore: [dev]

types: [opened, ]

jobs:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/download_dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ on:

CLIENT_IMPL:
type: string
description: 客户端类型(client.impl),[api]=移动端,[html]=网页端。下载失败时,你可以尝试填入此项重试。
description: 客户端类型(client.impl),下载失败时,你可以尝试填入此项重试。'api' 表示移动端,'html' 表示网页端
default: ''
required: false

IMAGE_SUFFIX:
type: string
description: 图片后缀(download.cache.suffix),默认为空,表示不做图片格式转换。可填入例如 "png" "jpg"。
description: 图片后缀(download.cache.suffix),默认为空,表示不做图片格式转换。可填入例如 'png' 'jpg'
default: ''
required: false

DIR_RULE:
type: string
description: 下载文件夹规则(dir_rule.rule)。此处可以不填,默认使用配置文件的'Bd_Aauthor_Atitle_Pindex'。
description: 下载文件夹规则(dir_rule.rule)。默认使用配置文件的 'Bd_Aauthor_Atitle_Pindex'。
default: ''
required: false

Expand Down
14 changes: 7 additions & 7 deletions assets/docs/sources/tutorial/5_filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ filter(过滤器)是v2.1.12新引入的机制,
使用filter的步骤如下:

```
1. 自定义class,继承JmDownloader,重写filter_iter_objs方法,即:
1. 自定义class,继承JmDownloader,重写do_filter方法,即:
class MyDownloader(JmDownloader):
def filter_iter_objs(self, iter_objs: DownloadIterObjs):
# 如何重写?参考JmDownloader.filter_iter_objs和下面的示例
def do_filter(self, iter_objs: DownloadIterObjs):
# 如何重写?参考JmDownloader.do_filter和下面的示例
...

2. 让你的class生效,使用如下代码:
Expand All @@ -30,8 +30,8 @@ from jmcomic import *

class First3ImageDownloader(JmDownloader):

def filter_iter_objs(self, iter_objs: DownloadIterObjs):
if isinstance(iter_objs, JmPhotoDetail):
def do_filter(self, detail):
if detail.is_photo():
photo: JmPhotoDetail = iter_objs
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable iter_objs is used within the method body but is not defined in the method signature. This should be updated to detail to match the method parameter.

-            photo: JmPhotoDetail = iter_objs
+            photo: JmPhotoDetail = detail

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
photo: JmPhotoDetail = iter_objs
photo: JmPhotoDetail = detail

# 支持[start,end,step]
return photo[:3]
Expand All @@ -52,8 +52,8 @@ class FindUpdateDownloader(JmDownloader):
'xxx': 'yyy'
}

def filter_iter_objs(self, iter_objs: DownloadIterObjs):
if not isinstance(iter_objs, JmAlbumDetail):
def do_filter(self, detail):
if not detail.is_album():
return iter_objs
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable iter_objs is used within the method body but is not defined in the method signature. This should be updated to detail to match the method parameter.

-            return iter_objs
+            return detail

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
return iter_objs
return detail


return self.find_update(iter_objs)
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.4.6'
__version__ = '2.4.7'

from .api import *
from .jm_plugin import *
Expand Down
Loading