Skip to content
Closed
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
7 changes: 7 additions & 0 deletions .github/workflows/download_dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ on:
- 是 | 本子维度合并pdf
- 是 | 章节维度合并pdf

PDF_NAME_RULE:
type: string
description: PDF输出的文件名规则。默认本子维度的为'[{Aid}] {Atitle}',章节维度的为'[{Aid}] {Pindex}_{Pid}_{Ptitle}'
default: ''
required: false

ZIP_NAME:
type: string
default: 本子.tar.gz
Expand Down Expand Up @@ -78,6 +84,7 @@ jobs:
UPLOAD_NAME: ${{ github.event.inputs.UPLOAD_NAME }}
IMAGE_SUFFIX: ${{ github.event.inputs.IMAGE_SUFFIX }}
PDF_OPTION: ${{ github.event.inputs.PDF_OPTION }}
PDF_NAME_RULE: ${{ github.event.inputs.PDF_NAME_RULE }}

# 登录相关secrets
JM_USERNAME: ${{ secrets.JM_USERNAME }}
Expand Down
7 changes: 6 additions & 1 deletion usage/workflow_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,16 @@ def cover_option_config(option: JmOption):
pdf_option = env('PDF_OPTION', None)
if pdf_option and pdf_option != '否':
call_when = 'after_album' if pdf_option == '是 | 本子维度合并pdf' else 'after_photo'

pdf_name_rule = env('PDF_NAME_RULE', None)
if not pdf_name_rule:
pdf_name_rule = '[{Aid}] {Atitle}' if call_when == 'after_album' else '[{Aid}] {Pindex}_{Pid}_{Ptitle}'

plugin = [{
'plugin': Img2pdfPlugin.plugin_key,
'kwargs': {
'pdf_dir': option.dir_rule.base_dir + '/pdf/',
'filename_rule': call_when[6].upper() + 'id',
'filename_rule': pdf_name_rule,
'delete_original_file': True,
}
}]
Expand Down
Loading