Skip to content

Commit 5d79df9

Browse files
committed
v2.5.32: 压缩插件zip支持单独下载章节(download_photo)时调用
1 parent 8274797 commit 5d79df9

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/jmcomic/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# 被依赖方 <--- 使用方
33
# config <--- entity <--- toolkit <--- client <--- option <--- downloader
44

5-
__version__ = '2.5.31'
5+
__version__ = '2.5.32'
66

77
from .api import *
88
from .jm_plugin import *

src/jmcomic/jm_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class JmMagicConstants:
7676
APP_TOKEN_SECRET = '18comicAPP'
7777
APP_TOKEN_SECRET_2 = '18comicAPPContent'
7878
APP_DATA_SECRET = '185Hcomic3PAPP7R'
79-
APP_VERSION = '1.7.6'
79+
APP_VERSION = '1.7.8'
8080

8181

8282
# 模块级别共用配置

src/jmcomic/jm_plugin.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,9 @@ class ZipPlugin(JmOptionPlugin):
278278

279279
# noinspection PyAttributeOutsideInit
280280
def invoke(self,
281-
album: JmAlbumDetail,
282281
downloader,
282+
album: JmAlbumDetail = None,
283+
photo: JmPhotoDetail = None,
283284
delete_original_file=False,
284285
level='photo',
285286
filename_rule='Ptitle',
@@ -298,7 +299,7 @@ def invoke(self,
298299
mkdir_if_not_exists(zip_dir)
299300

300301
path_to_delete = []
301-
photo_dict = downloader.download_success_dict[album]
302+
photo_dict = self.get_downloaded_photo(downloader, album, photo)
302303

303304
if level == 'album':
304305
zip_path = self.get_zip_path(album, None, filename_rule, suffix, zip_dir)
@@ -314,6 +315,13 @@ def invoke(self,
314315

315316
self.after_zip(path_to_delete)
316317

318+
def get_downloaded_photo(self, downloader, album, photo):
319+
return (
320+
downloader.download_success_dict[album]
321+
if album is not None # after_album
322+
else downloader.download_success_dict[photo.from_album] # after_photo
323+
)
324+
317325
def zip_photo(self, photo, image_list: list, zip_path: str, path_to_delete):
318326
"""
319327
压缩photo文件夹

0 commit comments

Comments
 (0)