mirror of
https://github.com/Yuukiy/JavSP.git
synced 2026-10-22 09:35:45 +08:00
支持自定义整理文件时路径中的'$actress'字段最多包含的女优人数
(不影响nfo文件中的女优列表)
This commit is contained in:
@@ -175,7 +175,12 @@ def generate_names(movie: Movie):
|
||||
d['num'] = info.dvdid or info.cid
|
||||
d['title'] = info.title or cfg.NamingRule.null_for_title
|
||||
d['rawtitle'] = info.ori_title or d['title']
|
||||
d['actress'] = ','.join(info.actress) if info.actress else cfg.NamingRule.null_for_actress
|
||||
if len(info.actress) > cfg.NamingRule.max_acctress_count:
|
||||
logging.debug('女优人数过多,按配置保留了其中的前n个: ' + ','.join(info.actress))
|
||||
actress = info.actress[:cfg.NamingRule.max_acctress_count] + ['…']
|
||||
else:
|
||||
actress = info.actress
|
||||
d['actress'] = ','.join(actress) if actress else cfg.NamingRule.null_for_actress
|
||||
d['score'] = info.score or '0'
|
||||
d['serial'] = info.serial or cfg.NamingRule.null_for_serial
|
||||
d['director'] = info.director or cfg.NamingRule.null_for_director
|
||||
@@ -232,7 +237,7 @@ def generate_names(movie: Movie):
|
||||
copyd['title'] = copyd['title'][:remaining]
|
||||
copyd['rawtitle'] = copyd['rawtitle'][:remaining]
|
||||
if (copyd['title'] == '' and '$title' in templates) or (copyd['rawtitle'] == '' and '$rawtitle' in templates):
|
||||
logger.error("命名规则导致标题被截断至空,请增大'max_path_len'配置项后重试")
|
||||
logger.error("命名规则导致标题被截断至空,请增大'max_path_len'或减小'max_acctress_count'配置项后重试")
|
||||
logger.debug((d, templates, cfg.NamingRule.max_path_len))
|
||||
return
|
||||
save_dir = os.path.normpath(cfg.NamingRule.save_dir.substitute(copyd)).strip()
|
||||
|
||||
@@ -66,6 +66,8 @@ save_dir = $actress/[$num] $title
|
||||
filename = $num
|
||||
# 允许的最长文件路径(以字符计数,不区分中英日字符。路径过长时将据此自动截短标题)
|
||||
max_path_len = 240
|
||||
# 路径中的$actress字段最多包含多少名女优?
|
||||
max_acctress_count = 10
|
||||
# nfo文件中的影片标题(即媒体管理工具中显示的标题)
|
||||
nfo_title = $num $title
|
||||
# 下面这些项用来设置对应变量为空时的替代信息
|
||||
|
||||
@@ -179,6 +179,7 @@ def norm_int(cfg: Config):
|
||||
cfg.Network.retry = cfg.getint('Network', 'retry')
|
||||
cfg.Network.timeout = cfg.getint('Network', 'timeout')
|
||||
cfg.NamingRule.max_path_len = min(cfg.getint('NamingRule', 'max_path_len'), 256)
|
||||
cfg.NamingRule.max_acctress_count = max(cfg.getint('NamingRule', 'max_acctress_count'), 1)
|
||||
|
||||
|
||||
def norm_tuples(cfg: Config):
|
||||
|
||||
Reference in New Issue
Block a user