@@ -5,13 +5,11 @@ class JmOptionAdvice:
55
66 def decide_image_save_dir (self ,
77 option : 'JmOption' ,
8- album_detail : Optional [JmAlbumDetail ],
98 photo_detail : JmPhotoDetail ,
109 ) -> StrNone :
1110 """
1211 决定一个本子图片的下载文件夹
1312 @param option: JmOption对象
14- @param album_detail: 本子集实体类
1513 @param photo_detail: 本子章节实体类
1614 @return: 下载文件夹,为空表示不处理
1715 """
@@ -245,19 +243,16 @@ def __init__(self,
245243 下面是决定图片保存路径的方法
246244 """
247245
248- def decide_image_save_dir (self , album_detail , photo_detail ) -> str :
249- if album_detail is None and photo_detail is None :
250- raise AssertionError ('album和photo不能同时为None' )
251-
246+ def decide_image_save_dir (self , photo_detail ) -> str :
252247 # 先检查advice的回调,如果回调支持,则优先使用回调
253248 for advice in JmAdviceRegistry .get_advice (self ):
254- save_dir = advice .decide_image_save_dir (self , album_detail , photo_detail )
249+ save_dir = advice .decide_image_save_dir (self , photo_detail )
255250 if save_dir is not None :
256251 return save_dir
257252
258253 # 使用 self.dir_tree 决定 save_dir
259254 save_dir = self .dir_tree .deside_image_save_dir (
260- album_detail or photo_detail .from_album ,
255+ photo_detail .from_album ,
261256 photo_detail
262257 )
263258
@@ -287,7 +282,7 @@ def decide_image_filepath(self, photo_detail: JmPhotoDetail, index: int) -> str:
287282 return filepath
288283
289284 # 通过拼接生成绝对路径
290- save_dir = self .decide_image_save_dir (photo_detail . from_album , photo_detail )
285+ save_dir = self .decide_image_save_dir (photo_detail )
291286 image : JmImageDetail = photo_detail [index ]
292287 suffix = self .decide_image_suffix (image )
293288 return save_dir + image .img_file_name + suffix
@@ -451,15 +446,13 @@ def build_save_path_provider(self,
451446
452447 if use_all_default_save_path is True :
453448 # 不通过请求获取 photo 的信息,相当于使用【空本子】和【空集】
454- photo_detail , album_detail = None , None
449+ photo_detail = None
455450 else :
456451 # 通过请求获得 photo 的本子信息
457- client = self .build_jm_client ()
458- photo_detail = client .get_photo_detail (photo_id )
459- album_detail = client .fill_from_album (photo_detail )
452+ photo_detail = self .build_jm_client ().get_photo_detail (photo_id )
460453
461454 def save_path_provider (url , _suffix : str , _index , _is_decode ):
462- return '{0}{1}{2}' .format (self .decide_image_save_dir (album_detail , photo_detail ),
455+ return '{0}{1}{2}' .format (self .decide_image_save_dir (photo_detail ),
463456 of_file_name (url , trim_suffix = True ),
464457 self .download_convert_image_suffix or _suffix )
465458
0 commit comments