@@ -111,7 +111,7 @@ def wait_until_finish(self):
111111 def decide_filepath (self ,
112112 album : Optional [JmAlbumDetail ],
113113 photo : Optional [JmPhotoDetail ],
114- filename_rule : str , suffix : str , base_dir : Optional [str ],
114+ filename_rule : Optional [ str ] , suffix : Optional [ str ] , base_dir : Optional [str ],
115115 dir_rule_dict : Optional [dict ]
116116 ):
117117 """
@@ -1219,7 +1219,7 @@ def new_decide_dir(photo, ensure_exists=True) -> str:
12191219
12201220
12211221class AdvancedRetryPlugin (JmOptionPlugin ):
1222- plugin_key = 'advanced-retry '
1222+ plugin_key = 'advanced_retry '
12231223
12241224 def __init__ (self , option : JmOption ):
12251225 super ().__init__ (option )
@@ -1306,3 +1306,25 @@ def update_failed_count(self, client: AbstractJmClient, domain: str):
13061306 def failed_count (client : JmcomicClient , domain : str ) -> int :
13071307 # noinspection PyUnresolvedReferences
13081308 return client .domain_req_failed_counter .get (domain , 0 )
1309+
1310+
1311+ class DownloadCoverPlugin (JmOptionPlugin ):
1312+ plugin_key = 'download_cover'
1313+
1314+ def invoke (self ,
1315+ dir_rule : dict ,
1316+ size = '' ,
1317+ photo : JmPhotoDetail = None ,
1318+ album : JmAlbumDetail = None ,
1319+ downloader = None ,
1320+ ** kwargs ) -> None :
1321+ album_id = album .id if album else photo .album_id
1322+ save_path = self .decide_filepath (
1323+ album , photo ,
1324+ None , None , None ,
1325+ dir_rule
1326+ )
1327+ if self .option .download .cache and os .path .exists (save_path ):
1328+ self .log (f'album-{ album_id } 的封面已存在,跳过下载: [{ save_path } ]' , 'skip' )
1329+ return
1330+ downloader .client .download_album_cover (album_id , save_path , size )
0 commit comments