From 542624514fd3f8425049eb19820dcaa170671942 Mon Sep 17 00:00:00 2001 From: Yuukiy <76897913+Yuukiy@users.noreply.github.com> Date: Sat, 30 Dec 2023 17:30:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=BD=E5=90=8D=E8=A7=84=E5=88=99=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=AD=97=E6=AE=B5`$censor`=E6=9D=A5=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E5=BD=B1=E7=89=87=E7=9A=84=20=E6=9C=89=E7=A0=81/=E6=97=A0?= =?UTF-8?q?=E7=A0=81=20=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JavSP.py | 24 ++++++++++-------------- core/config.ini | 10 +++++++--- core/config.py | 5 +++++ core/file.py | 14 +++++++++++--- 4 files changed, 33 insertions(+), 20 deletions(-) diff --git a/JavSP.py b/JavSP.py index f356f993e..1024dae17 100644 --- a/JavSP.py +++ b/JavSP.py @@ -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 diff --git a/core/config.ini b/core/config.ini index 90b685a1d..65416ed59 100644 --- a/core/config.ini +++ b/core/config.ini @@ -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 = #未知女优 diff --git a/core/config.py b/core/config.py index 28dbe4425..3d327c73a 100644 --- a/core/config.py +++ b/core/config.py @@ -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): diff --git a/core/file.py b/core/file.py index 719cd35ac..9851f8d0a 100644 --- a/core/file.py +++ b/core/file.py @@ -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))