@@ -344,6 +344,29 @@ def _migrate_zip_level(cls, plugins: dict):
344344 level 已废弃,打包粒度由所在钩子的上下文自动推导。
345345 迁移规则:level='album' → 确保在 after_album;其他 → 确保在 after_photo。
346346 """
347+
348+ def log_advice (reason , plugins ):
349+ import yaml
350+ # 意图聚焦:建议配置中只展示相关的 zip 插件,剔除其他无关插件的干扰
351+ advice_plugins = {}
352+ for g , plist in plugins .items ():
353+ zips = [p for p in plist if p .get ('plugin' ) == 'zip' ]
354+ if zips :
355+ advice_plugins [g ] = zips
356+
357+ if not advice_plugins :
358+ return
359+
360+ plugins_yml = yaml .dump ({'plugins' : advice_plugins }, default_flow_style = False , indent = 2 , sort_keys = False ).strip ()
361+
362+ jm_log ('option.migrate' ,
363+ f'[zip 插件迁移] level 参数已过时,建议直接删除。'
364+ f'{ reason } ,建议参考如下的等价新写法:\n '
365+ f'```yml\n '
366+ f'{ plugins_yml } \n '
367+ f'```'
368+ )
369+
347370 for group in ['after_album' , 'after_photo' ]:
348371 plugin_list = plugins .get (group )
349372 if not isinstance (plugin_list , list ):
@@ -365,18 +388,18 @@ def _migrate_zip_level(cls, plugins: dict):
365388 # after_album + level=photo → 等价迁移到 after_photo
366389 plugins .setdefault ('after_photo' , []).append (pinfo )
367390 plugin_list .pop (i )
368- jm_log ( 'option.migrate' ,
369- f'[zip 插件迁移] level 参数已过时,建议删除level参数。'
370- f'你的当前配置为,在本子下载完毕后按章节压缩,建议改为如下的等价新写法: \n '
371- f'plugins: \n '
372- f' after_photo: \n '
373- f' - plugin: { pinfo [ "plugin" ] } \n '
374- f' kwargs: { pinfo [ "kwargs" ] } \n '
375- )
391+ log_advice ( '你的当前配置为:在本子下载完毕后按章节压缩' , plugins )
392+
393+ elif group == 'after_photo' and level == 'album' :
394+ # after_photo + level=album → 等价迁移到 after_album
395+ plugins . setdefault ( 'after_album' , []). append ( pinfo )
396+ plugin_list . pop ( i )
397+ log_advice ( '你的当前配置为:在单章节下载完毕后对全本进行压缩' , plugins )
398+
376399 else :
377400 if level != 'photo' :
378401 jm_log ('option.migrate' ,
379- f '[zip 插件迁移] level 参数已过时,你可以直接删除该参数,不会有任何影响' )
402+ '[zip 插件迁移] level 参数已过时,你可以直接删除该参数,不会有任何影响' )
380403 i += 1
381404
382405 def deconstruct (self ) -> Dict :
0 commit comments