Skip to content

Commit f2c255e

Browse files
authored
优化GitHub Actions工作流 (#156)
1 parent f4493cb commit f2c255e

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

.github/workflows/download.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ jobs:
4141
pip install -e ./
4242
4343
- name: 运行下载脚本
44-
continue-on-error: true
4544
run: |
4645
cd ./usage/
4746
python workflow_download.py

.github/workflows/download_dispatch.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,21 @@ on:
1313
description: 章节id(单独下载章节,多个id同上)
1414
required: false
1515

16-
DIR_RULE:
16+
CLIENT_IMPL:
1717
type: string
18-
description: 下载文件夹规则(dir_rule.rule)。此处可以不填,默认使用配置文件的'Bd_Aauthor_Atitle_Pindex'。
18+
description: 客户端类型(client.impl),[api]=移动端,[html]=网页端。
19+
default: 'api'
20+
required: false
21+
22+
IMAGE_SUFFIX:
23+
type: string
24+
description: 图片后缀(download.cache.suffix),默认为空,表示不做图片格式转换。可填入例如 "png" "jpg"。
1925
default: ''
2026
required: false
2127

22-
CLIENT_IMPL:
28+
DIR_RULE:
2329
type: string
24-
description: 客户端类型(client.impl),[api]=移动端,[html]=网页端,此处可以不填,默认使用'html'。如果你发现默认的下载不了,可以填api试试
30+
description: 下载文件夹规则(dir_rule.rule)。此处可以不填,默认使用配置文件的'Bd_Aauthor_Atitle_Pindex'
2531
default: ''
2632
required: false
2733

@@ -61,6 +67,7 @@ jobs:
6167
CLIENT_IMPL: ${{ github.event.inputs.CLIENT_IMPL }}
6268
ZIP_NAME: ${{ github.event.inputs.ZIP_NAME }}
6369
UPLOAD_NAME: ${{ github.event.inputs.UPLOAD_NAME }}
70+
IMAGE_SUFFIX: ${{ github.event.inputs.IMAGE_SUFFIX }}
6471
# secrets
6572
JM_USERNAME: ${{ secrets.JM_USERNAME }}
6673
JM_PASSWORD: ${{ secrets.JM_PASSWORD }}
@@ -90,7 +97,6 @@ jobs:
9097
pip install -e ./
9198
9299
- name: 运行下载脚本
93-
continue-on-error: true
94100
run: |
95101
cd ./usage/
96102
python workflow_download.py

usage/workflow_download.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
from jmcomic import *
22
from jmcomic.cl import get_env, JmcomicUI
33

4-
# 下方填入你要下载的本子的id,一行一个。
5-
# 每行的首尾可以有空白字符
6-
# 你也可以填入本子网址,程序会识别出本子id
7-
# 例如:
8-
# [https://18comic.vip/album/452859/mana-ディシア-1-原神-中国語-無修正] -> [452859]
9-
#
4+
# 下方填入你要下载的本子的id,一行一个,每行的首尾可以有空白字符
105
jm_albums = '''
116
127
@@ -17,6 +12,7 @@
1712
jm_photos = '''
1813
1914
15+
2016
'''
2117

2218

@@ -68,11 +64,10 @@ def cover_option_config(option: JmOption):
6864
impl = get_env('CLIENT_IMPL', None)
6965
if impl is not None:
7066
option.client.impl = impl
71-
else:
72-
impl = option.client.impl
7367

74-
if impl == 'api':
75-
option.client.domain = JmModuleConfig.DOMAIN_API_LIST
68+
suffix = get_env('IMAGE_SUFFIX', None)
69+
if suffix is not None:
70+
option.download.image.suffix = fix_suffix(suffix)
7671

7772

7873
def login_if_configured(option):

0 commit comments

Comments
 (0)