mirror of
https://github.com/Yuukiy/JavSP.git
synced 2026-10-18 14:50:56 +08:00
命名规则新增字段$censor来表示影片的 有码/无码 情况
This commit is contained in:
@@ -147,20 +147,8 @@ def info_summary(movie: Movie, all_info: Dict[str, MovieInfo]):
|
||||
final_info = MovieInfo(movie)
|
||||
########## 部分字段配置了专门的选取逻辑,先处理这些字段 ##########
|
||||
# genre
|
||||
if 'javdb' in all_info:
|
||||
if 'javdb' in all_info and all_info['javdb'].genre:
|
||||
final_info.genre = all_info['javdb'].genre
|
||||
else:
|
||||
for name, data in all_info.items():
|
||||
if data.genre != None:
|
||||
final_info.genre = all_info[name].genre
|
||||
break
|
||||
|
||||
if not final_info.genre:
|
||||
final_info.genre = []
|
||||
if movie.hard_sub:
|
||||
final_info.genre.append('内嵌字幕')
|
||||
if movie.uncensored:
|
||||
final_info.genre.append('无码流出/破解')
|
||||
|
||||
########## 移除所有抓取器数据中,标题尾部的女优名 ##########
|
||||
if cfg.Crawler.title__remove_actor:
|
||||
@@ -186,7 +174,7 @@ def info_summary(movie: Movie, all_info: Dict[str, MovieInfo]):
|
||||
absorbed.append(attr)
|
||||
else:
|
||||
current = getattr(final_info, attr)
|
||||
if (not current) and (incoming):
|
||||
if (current is None) and (incoming is not None):
|
||||
setattr(final_info, attr, incoming)
|
||||
absorbed.append(attr)
|
||||
if absorbed:
|
||||
@@ -216,6 +204,13 @@ def info_summary(movie: Movie, all_info: Dict[str, MovieInfo]):
|
||||
if big_covers:
|
||||
final_info.big_cover = big_covers[0]
|
||||
########## 部分字段放在最后进行检查 ##########
|
||||
# 特殊的 genre
|
||||
if final_info.genre is None:
|
||||
final_info.genre = []
|
||||
if movie.hard_sub:
|
||||
final_info.genre.append('内嵌字幕')
|
||||
if movie.uncensored:
|
||||
final_info.genre.append('无码流出/破解')
|
||||
# title
|
||||
if cfg.Crawler.title__chinese_first and 'airav' in all_info:
|
||||
if all_info['airav'].title and final_info.title != all_info['airav'].title:
|
||||
@@ -246,6 +241,7 @@ def generate_names(movie: Movie):
|
||||
actress = info.actress
|
||||
d['actress'] = ','.join(actress) if actress else cfg.NamingRule.null_for_actress
|
||||
d['score'] = info.score or '0'
|
||||
d['censor'] = cfg.NamingRule.censorship_names[info.uncensored]
|
||||
d['serial'] = info.serial or cfg.NamingRule.null_for_serial
|
||||
d['director'] = info.director or cfg.NamingRule.null_for_director
|
||||
d['producer'] = info.producer or cfg.NamingRule.null_for_producer
|
||||
|
||||
+7
-3
@@ -56,9 +56,9 @@ sleep_after_scraping = 1
|
||||
# 各个站点的免代理地址。地址失效时软件会自动尝试获取新地址,你也可以手动设置
|
||||
[ProxyFree]
|
||||
avsox = https://avsox.click
|
||||
javdb = https://javdb521.com
|
||||
javbus = https://www.busfan.cfd
|
||||
javlib = https://www.a66j.com
|
||||
javdb = https://javdb523.com
|
||||
javbus = https://www.busdmm.shop
|
||||
javlib = https://www.i71t.com
|
||||
|
||||
# 配置整理时的命名规则
|
||||
# save_dir, nfo_title和filename中可以使用变量来引用影片的数据,支持的变量列表见下面的地址:
|
||||
@@ -80,6 +80,10 @@ calc_path_len_by_byte = auto
|
||||
max_actress_count = 10
|
||||
# nfo文件中的影片标题(即媒体管理工具中显示的标题)
|
||||
nfo_title = $num $title
|
||||
# 下面三个选项依次设置 已知有码/已知无码/不确定 这三种情况下 $censor 对应的文本(可以利用此变量将有码/无码影片整理到不同文件夹)
|
||||
text_for_censored = 有码
|
||||
text_for_uncensored = 无码
|
||||
text_for_unknown_censorship = 打码情况未知
|
||||
# 下面这些项用来设置对应变量为空时的替代信息
|
||||
null_for_title = #未知标题
|
||||
null_for_actress = #未知女优
|
||||
|
||||
@@ -364,6 +364,11 @@ def convert_naming_rule(cfg: Config):
|
||||
cfg.NamingRule.save_dir = Template(combine)
|
||||
cfg.NamingRule.filename = Template(cfg.NamingRule.filename)
|
||||
cfg.NamingRule.nfo_title = Template(cfg.NamingRule.nfo_title)
|
||||
cfg.NamingRule.censorship_names = {
|
||||
False: cfg.NamingRule.text_for_censored,
|
||||
True: cfg.NamingRule.text_for_uncensored,
|
||||
None: cfg.NamingRule.text_for_unknown_censorship,
|
||||
}
|
||||
|
||||
|
||||
def check_proxy_free_url(cfg: Config):
|
||||
|
||||
+11
-3
@@ -57,13 +57,21 @@ def scan_movies(root: str) -> List[Movie]:
|
||||
fail.files = [fullpath]
|
||||
failed_items.append(fail)
|
||||
logger.error(f"无法提取影片番号: '{fullpath}'")
|
||||
# 多分片影片容易有文件大小低于阈值的子片,进行特殊处理
|
||||
has_avid = {}
|
||||
for name in list(small_videos.keys()):
|
||||
dvdid = get_id(name)
|
||||
cid = get_cid(name)
|
||||
avid = cid if cid else dvdid
|
||||
if avid in dic:
|
||||
dic[avid].extend(small_videos.pop(name))
|
||||
elif avid:
|
||||
has_avid[name] = avid
|
||||
# 对于前面忽略的视频生成一个简单的提示
|
||||
small_videos = {k:sorted(v) for k,v in sorted(small_videos.items())}
|
||||
try_avid = [get_id(i) for i in small_videos.keys()]
|
||||
has_avid = [name for name, avid in zip(small_videos.keys(), try_avid) if avid]
|
||||
skipped_files = list(itertools.chain(*small_videos.values()))
|
||||
if len(has_avid) > 0:
|
||||
logger.info(f"跳过了 {','.join(has_avid)} 等{len(skipped_files)}个小于指定大小的视频文件")
|
||||
logger.info(f"跳过了 {', '.join(has_avid)} 等{len(skipped_files)}个小于指定大小的视频文件")
|
||||
else:
|
||||
logger.info(f"跳过了{len(skipped_files)}个小于指定大小的视频文件")
|
||||
logger.debug('跳过的视频文件如下:\n' + '\n'.join(skipped_files))
|
||||
|
||||
Reference in New Issue
Block a user