add jellyfin setting
This commit is contained in:
31
core.py
31
core.py
@@ -279,15 +279,15 @@ def image_ext(url):
|
||||
|
||||
# 封面是否下载成功,否则移动到failed
|
||||
def image_download(cover, fanart_path, thumb_path, path, filepath, json_headers=None):
|
||||
full_filepath = os.path.join(path, fanart_path)
|
||||
full_filepath = os.path.join(path, thumb_path)
|
||||
if config.getInstance().download_only_missing_images() and not file_not_exist_or_empty(full_filepath):
|
||||
return
|
||||
if json_headers != None:
|
||||
if download_file_with_filename(cover, fanart_path, path, filepath, json_headers['headers']) == 'failed':
|
||||
if download_file_with_filename(cover, thumb_path, path, filepath, json_headers['headers']) == 'failed':
|
||||
moveFailedFolder(filepath)
|
||||
return
|
||||
else:
|
||||
if download_file_with_filename(cover, fanart_path, path, filepath) == 'failed':
|
||||
if download_file_with_filename(cover, thumb_path, path, filepath) == 'failed':
|
||||
moveFailedFolder(filepath)
|
||||
return
|
||||
|
||||
@@ -296,16 +296,17 @@ def image_download(cover, fanart_path, thumb_path, path, filepath, json_headers=
|
||||
if file_not_exist_or_empty(full_filepath):
|
||||
print('[!]Image Download Failed! Trying again. [{}/3]', i + 1)
|
||||
if json_headers != None:
|
||||
download_file_with_filename(cover, fanart_path, path, filepath, json_headers['headers'])
|
||||
download_file_with_filename(cover, thumb_path, path, filepath, json_headers['headers'])
|
||||
else:
|
||||
download_file_with_filename(cover, fanart_path, path, filepath)
|
||||
download_file_with_filename(cover, thumb_path, path, filepath)
|
||||
continue
|
||||
else:
|
||||
break
|
||||
if file_not_exist_or_empty(full_filepath):
|
||||
return
|
||||
print('[+]Image Downloaded!', Path(full_filepath).name)
|
||||
shutil.copyfile(full_filepath, os.path.join(path, thumb_path))
|
||||
if not config.getInstance().jellyfin():
|
||||
shutil.copyfile(full_filepath, os.path.join(path, fanart_path))
|
||||
|
||||
|
||||
def print_files(path, leak_word, c_word, naming_rule, part, cn_sub, json_data, filepath, tag, actor_list, liuchu,
|
||||
@@ -332,7 +333,12 @@ def print_files(path, leak_word, c_word, naming_rule, part, cn_sub, json_data, f
|
||||
pass
|
||||
# KODI内查看影片信息时找不到number,配置naming_rule=number+'#'+title虽可解决
|
||||
# 但使得标题太长,放入时常为空的outline内会更适合,软件给outline留出的显示版面也较大
|
||||
outline = f"{number}#{outline}"
|
||||
if not outline:
|
||||
pass
|
||||
elif json_data['source'] == 'pissplay':
|
||||
outline = f"{outline}"
|
||||
else:
|
||||
outline = f"{number}#{outline}"
|
||||
with open(nfo_path, "wt", encoding='UTF-8') as code:
|
||||
print('<?xml version="1.0" encoding="UTF-8" ?>', file=code)
|
||||
print("<movie>", file=code)
|
||||
@@ -352,7 +358,8 @@ def print_files(path, leak_word, c_word, naming_rule, part, cn_sub, json_data, f
|
||||
print(" <runtime>" + str(runtime).replace(" ", "") + "</runtime>", file=code)
|
||||
print(" <director>" + director + "</director>", file=code)
|
||||
print(" <poster>" + poster_path + "</poster>", file=code)
|
||||
print(" <thumb>" + thumb_path + "</thumb>", file=code)
|
||||
if not config.getInstance().jellyfin(): # jellyfin 不需要保存thunb
|
||||
print(" <thumb>" + thumb_path + "</thumb>", file=code)
|
||||
print(" <fanart>" + fanart_path + "</fanart>", file=code)
|
||||
try:
|
||||
for key in actor_list:
|
||||
@@ -368,8 +375,8 @@ def print_files(path, leak_word, c_word, naming_rule, part, cn_sub, json_data, f
|
||||
print(" <maker>" + studio + "</maker>", file=code)
|
||||
print(" <label>" + label + "</label>", file=code)
|
||||
|
||||
skip_tags = config.getInstance().donot_save_tags()
|
||||
if not skip_tags:
|
||||
jellyfin = config.getInstance().jellyfin()
|
||||
if not jellyfin:
|
||||
if config.getInstance().actor_only_tag():
|
||||
for key in actor_list:
|
||||
try:
|
||||
@@ -920,7 +927,7 @@ def core_main(movie_path, number_th, oCC, specified_source=None, specified_url=N
|
||||
pass
|
||||
|
||||
# 裁剪图
|
||||
cutImage(imagecut, path, fanart_path, poster_path, bool(conf.face_uncensored_only() and not uncensored))
|
||||
cutImage(imagecut, path, thumb_path, poster_path, bool(conf.face_uncensored_only() and not uncensored))
|
||||
|
||||
# 兼容Jellyfin封面图文件名规则
|
||||
if multi_part and conf.jellyfin_multi_part_fanart():
|
||||
@@ -998,7 +1005,7 @@ def core_main(movie_path, number_th, oCC, specified_source=None, specified_url=N
|
||||
|
||||
# 添加水印
|
||||
if conf.is_watermark():
|
||||
add_mark(os.path.join(path, poster_path), os.path.join(path, thumb_path), cn_sub, leak, uncensored, hack,
|
||||
add_mark(os.path.join(path, poster_path), os.path.join(path, fanart_path), cn_sub, leak, uncensored, hack,
|
||||
_4k)
|
||||
|
||||
# 兼容Jellyfin封面图文件名规则
|
||||
|
||||
Reference in New Issue
Block a user