Merge branch 'master' of github.com:yoshiko2/Movie_Data_Capture

This commit is contained in:
hejianjun
2023-03-22 11:31:57 +08:00
4 changed files with 27 additions and 26 deletions

View File

@@ -104,9 +104,9 @@ is performed. It may help you correct wrong numbers before real job.""")
set_str_or_none("common:source_folder", args.path) set_str_or_none("common:source_folder", args.path)
set_bool_or_none("common:auto_exit", args.auto_exit) set_bool_or_none("common:auto_exit", args.auto_exit)
set_natural_number_or_none("common:nfo_skip_days", args.days) set_natural_number_or_none("common:nfo_skip_days", args.days)
set_natural_number_or_none("common:stop_counter", args.cnt) set_natural_number_or_none("advenced_sleep:stop_counter", args.cnt)
set_bool_or_none("common:ignore_failed_list", args.ignore_failed_list) set_bool_or_none("common:ignore_failed_list", args.ignore_failed_list)
set_str_or_none("common:rerun_delay", args.delaytm) set_str_or_none("advenced_sleep:rerun_delay", args.delaytm)
set_str_or_none("priority:website", args.site) set_str_or_none("priority:website", args.site)
if isinstance(args.dnimg, bool) and args.dnimg: if isinstance(args.dnimg, bool) and args.dnimg:
conf.set_override("common:download_only_missing_images=0") conf.set_override("common:download_only_missing_images=0")
@@ -119,7 +119,7 @@ is performed. It may help you correct wrong numbers before real job.""")
if conf.main_mode() == 3: if conf.main_mode() == 3:
no_net_op = args.no_network_operation no_net_op = args.no_network_operation
if no_net_op: if no_net_op:
conf.set_override("common:stop_counter=0;rerun_delay=0s;face:aways_imagecut=1") conf.set_override("advenced_sleep:stop_counter=0;advenced_sleep:rerun_delay=0s;face:aways_imagecut=1")
return args.file, args.number, args.logdir, args.regexstr, args.zero_op, no_net_op, args.specified_source, args.specified_url return args.file, args.number, args.logdir, args.regexstr, args.zero_op, no_net_op, args.specified_source, args.specified_url
@@ -681,7 +681,7 @@ def period(delta, pattern):
if __name__ == '__main__': if __name__ == '__main__':
version = '6.5.1' version = '6.5.2'
urllib3.disable_warnings() # Ignore http proxy warning urllib3.disable_warnings() # Ignore http proxy warning
app_start = time.time() app_start = time.time()

23
core.py
View File

@@ -347,11 +347,11 @@ def print_files(path, leak_word, c_word, naming_rule, part, cn_sub, json_data, f
print("<movie>", file=code) print("<movie>", file=code)
if not config.getInstance().jellyfin(): if not config.getInstance().jellyfin():
print(" <title><![CDATA[" + naming_rule + "]]></title>", file=code) print(" <title><![CDATA[" + naming_rule + "]]></title>", file=code)
print(" <originaltitle><![CDATA[" + naming_rule + "]]></originaltitle>", file=code) print(" <originaltitle><![CDATA[" + json_data['original_naming_rule'] + "]]></originaltitle>", file=code)
print(" <sorttitle><![CDATA[" + naming_rule + "]]></sorttitle>", file=code) print(" <sorttitle><![CDATA[" + naming_rule + "]]></sorttitle>", file=code)
else: else:
print(" <title>" + naming_rule + "</title>", file=code) print(" <title>" + naming_rule + "</title>", file=code)
print(" <originaltitle>" + naming_rule + "</originaltitle>", file=code) print(" <originaltitle>" + json_data['original_naming_rule'] + "</originaltitle>", file=code)
print(" <sorttitle>" + naming_rule + "</sorttitle>", file=code) print(" <sorttitle>" + naming_rule + "</sorttitle>", file=code)
print(" <customrating>JP-18+</customrating>", file=code) print(" <customrating>JP-18+</customrating>", file=code)
print(" <mpaa>JP-18+</mpaa>", file=code) print(" <mpaa>JP-18+</mpaa>", file=code)
@@ -633,6 +633,8 @@ def paste_file_to_folder_mode2(filepath, path, multi_part, number, part, leak_wo
create_softlink = False create_softlink = False
if link_mode not in (1, 2): if link_mode not in (1, 2):
shutil.move(filepath, targetpath) shutil.move(filepath, targetpath)
print("[!]Move => ", path)
return
elif link_mode == 2: elif link_mode == 2:
try: try:
os.link(filepath, targetpath, follow_symlinks=False) os.link(filepath, targetpath, follow_symlinks=False)
@@ -644,16 +646,13 @@ def paste_file_to_folder_mode2(filepath, path, multi_part, number, part, leak_wo
os.symlink(filerelpath, targetpath) os.symlink(filerelpath, targetpath)
except: except:
os.symlink(str(filepath_obj.resolve()), targetpath) os.symlink(str(filepath_obj.resolve()), targetpath)
return print("[!]Link => ", path)
except FileExistsError as fee: except FileExistsError as fee:
print(f'[-]FileExistsError: {fee}') print(f'[-]FileExistsError: {fee}')
return
except PermissionError: except PermissionError:
print('[-]Error! Please run as administrator!') print('[-]Error! Please run as administrator!')
return
except OSError as oserr: except OSError as oserr:
print(f'[-]OS Error errno {oserr.errno}') print(f'[-]OS Error errno {oserr.errno}')
return
def linkImage(path, number, part, leak_word, c_word, hack_word, ext): def linkImage(path, number, part, leak_word, c_word, hack_word, ext):
@@ -971,13 +970,9 @@ def core_main(movie_path, number_th, oCC, specified_source=None, specified_url=N
path = create_folder(json_data) path = create_folder(json_data)
# 移动文件 # 移动文件
paste_file_to_folder_mode2(movie_path, path, multi_part, number, part, leak_word, c_word, hack_word) paste_file_to_folder_mode2(movie_path, path, multi_part, number, part, leak_word, c_word, hack_word)
# Move subtitles # Move subtitles
move_status = move_subtitles(movie_path, path, multi_part, number, part, leak_word, c_word, hack_word) move_subtitles(movie_path, path, multi_part, number, part, leak_word, c_word, hack_word)
if move_status:
cn_sub = True
if conf.is_watermark():
add_mark(os.path.join(path, poster_path), os.path.join(path, thumb_path), cn_sub, leak, uncensored, hack,
_4k)
elif conf.main_mode() == 3: elif conf.main_mode() == 3:
path = str(Path(movie_path).parent) path = str(Path(movie_path).parent)
@@ -1030,5 +1025,5 @@ def core_main(movie_path, number_th, oCC, specified_source=None, specified_url=N
# 最后输出.nfo元数据文件以完成.nfo文件创建作为任务成功标志 # 最后输出.nfo元数据文件以完成.nfo文件创建作为任务成功标志
print_files(path, leak_word, c_word, json_data.get('naming_rule'), part, cn_sub, json_data, movie_path, print_files(path, leak_word, c_word, json_data.get('naming_rule'), part, cn_sub, json_data, movie_path,
tag, json_data.get('actor_list'), liuchu, uncensored, hack, hack_word, fanart_path, poster_path, tag, json_data.get('actor_list'), liuchu, uncensored, hack, hack_word, _4k, fanart_path, poster_path,
_4k, thumb_path) thumb_path)

View File

@@ -269,14 +269,22 @@ def get_data_from_json(
pass pass
naming_rule = "" naming_rule = ""
original_naming_rule = ""
for i in conf.naming_rule().split("+"): for i in conf.naming_rule().split("+"):
if i not in json_data: if i not in json_data:
naming_rule += i.strip("'").strip('"') naming_rule += i.strip("'").strip('"')
original_naming_rule += i.strip("'").strip('"')
else: else:
item = json_data.get(i) item = json_data.get(i)
naming_rule += item if type(item) is not list else "&".join(item) naming_rule += item if type(item) is not list else "&".join(item)
# PATCH处理[title]存在翻译的情况后续NFO文件的original_name只会直接沿用naming_rule,这导致original_name非原始名
# 理应在翻译处处理 naming_rule和original_naming_rule
if i == 'title':
item = json_data.get('original_title')
original_naming_rule += item if type(item) is not list else "&".join(item)
json_data['naming_rule'] = naming_rule json_data['naming_rule'] = naming_rule
json_data['original_naming_rule'] = original_naming_rule
return json_data return json_data

View File

@@ -49,15 +49,13 @@ class Fanza(Parser):
self.detailurl = url + fanza_search_number self.detailurl = url + fanza_search_number
url = "https://www.dmm.co.jp/age_check/=/declared=yes/?"+ urlencode({"rurl": self.detailurl}) url = "https://www.dmm.co.jp/age_check/=/declared=yes/?"+ urlencode({"rurl": self.detailurl})
self.htmlcode = self.getHtml(url) self.htmlcode = self.getHtml(url)
if "Sorry! This content is not available in your region." in self.htmlcode: if self.htmlcode != 404 \
continue and 'Sorry! This content is not available in your region.' not in self.htmlcode:
if self.htmlcode != 404:
self.htmltree = etree.HTML(self.htmlcode) self.htmltree = etree.HTML(self.htmlcode)
break if self.htmltree is not None:
if self.htmlcode == 404: result = self.dictformat(self.htmltree)
return 404 return result
result = self.dictformat(self.htmltree) return 404
return result
def getNum(self, htmltree): def getNum(self, htmltree):
# for some old page, the input number does not match the page # for some old page, the input number does not match the page