add jellyfin setting
This commit is contained in:
@@ -60,9 +60,9 @@ def face_crop_height(filename, width, height):
|
|||||||
return (0, 0, width, cropHeight)
|
return (0, 0, width, cropHeight)
|
||||||
|
|
||||||
|
|
||||||
def cutImage(imagecut, path, fanart_path, poster_path, skip_facerec=False):
|
def cutImage(imagecut, path, thumb_path, poster_path, skip_facerec=False):
|
||||||
conf = config.getInstance()
|
conf = config.getInstance()
|
||||||
fullpath_fanart = os.path.join(path, fanart_path)
|
fullpath_fanart = os.path.join(path, thumb_path)
|
||||||
fullpath_poster = os.path.join(path, poster_path)
|
fullpath_poster = os.path.join(path, poster_path)
|
||||||
aspect_ratio = conf.face_aspect_ratio()
|
aspect_ratio = conf.face_aspect_ratio()
|
||||||
if conf.face_aways_imagecut():
|
if conf.face_aways_imagecut():
|
||||||
|
|||||||
@@ -21,8 +21,10 @@ nfo_skip_days = 30
|
|||||||
ignore_failed_list = 0
|
ignore_failed_list = 0
|
||||||
download_only_missing_images = 1
|
download_only_missing_images = 1
|
||||||
mapping_table_validity = 7
|
mapping_table_validity = 7
|
||||||
|
; 一些jellyfin中特有的设置 (0:不开启, 1:开启) 比如
|
||||||
; 在jellyfin中tags和genres重复,因此可以只保存genres到nfo中
|
; 在jellyfin中tags和genres重复,因此可以只保存genres到nfo中
|
||||||
donot_save_tags = 0
|
; jellyfin中只需要保存fanart,不需要保存thumb
|
||||||
|
jellyfin = 0
|
||||||
; 开启后tag和genere只显示演员
|
; 开启后tag和genere只显示演员
|
||||||
actor_only_tag = 0
|
actor_only_tag = 0
|
||||||
sleep = 3
|
sleep = 3
|
||||||
|
|||||||
@@ -213,8 +213,8 @@ class Config:
|
|||||||
def mapping_table_validity(self) -> int:
|
def mapping_table_validity(self) -> int:
|
||||||
return self.conf.getint("common", "mapping_table_validity")
|
return self.conf.getint("common", "mapping_table_validity")
|
||||||
|
|
||||||
def donot_save_tags(self) -> int:
|
def jellyfin(self) -> int:
|
||||||
return self.conf.getint("common", "donot_save_tags")
|
return self.conf.getint("common", "jellyfin")
|
||||||
|
|
||||||
def actor_only_tag(self) -> bool:
|
def actor_only_tag(self) -> bool:
|
||||||
return self.conf.getboolean("common", "actor_only_tag")
|
return self.conf.getboolean("common", "actor_only_tag")
|
||||||
@@ -443,7 +443,7 @@ class Config:
|
|||||||
conf.set(sec1, "ignore_failed_list", 0)
|
conf.set(sec1, "ignore_failed_list", 0)
|
||||||
conf.set(sec1, "download_only_missing_images", 1)
|
conf.set(sec1, "download_only_missing_images", 1)
|
||||||
conf.set(sec1, "mapping_table_validity", 7)
|
conf.set(sec1, "mapping_table_validity", 7)
|
||||||
conf.set(sec1, "donot_save_tags", 0)
|
conf.set(sec1, "jellyfin", 0)
|
||||||
|
|
||||||
sec2 = "advenced_sleep"
|
sec2 = "advenced_sleep"
|
||||||
conf.add_section(sec2)
|
conf.add_section(sec2)
|
||||||
|
|||||||
31
core.py
31
core.py
@@ -279,15 +279,15 @@ def image_ext(url):
|
|||||||
|
|
||||||
# 封面是否下载成功,否则移动到failed
|
# 封面是否下载成功,否则移动到failed
|
||||||
def image_download(cover, fanart_path, thumb_path, path, filepath, json_headers=None):
|
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):
|
if config.getInstance().download_only_missing_images() and not file_not_exist_or_empty(full_filepath):
|
||||||
return
|
return
|
||||||
if json_headers != None:
|
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)
|
moveFailedFolder(filepath)
|
||||||
return
|
return
|
||||||
else:
|
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)
|
moveFailedFolder(filepath)
|
||||||
return
|
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):
|
if file_not_exist_or_empty(full_filepath):
|
||||||
print('[!]Image Download Failed! Trying again. [{}/3]', i + 1)
|
print('[!]Image Download Failed! Trying again. [{}/3]', i + 1)
|
||||||
if json_headers != None:
|
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:
|
else:
|
||||||
download_file_with_filename(cover, fanart_path, path, filepath)
|
download_file_with_filename(cover, thumb_path, path, filepath)
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
if file_not_exist_or_empty(full_filepath):
|
if file_not_exist_or_empty(full_filepath):
|
||||||
return
|
return
|
||||||
print('[+]Image Downloaded!', Path(full_filepath).name)
|
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,
|
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
|
pass
|
||||||
# KODI内查看影片信息时找不到number,配置naming_rule=number+'#'+title虽可解决
|
# KODI内查看影片信息时找不到number,配置naming_rule=number+'#'+title虽可解决
|
||||||
# 但使得标题太长,放入时常为空的outline内会更适合,软件给outline留出的显示版面也较大
|
# 但使得标题太长,放入时常为空的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:
|
with open(nfo_path, "wt", encoding='UTF-8') as code:
|
||||||
print('<?xml version="1.0" encoding="UTF-8" ?>', file=code)
|
print('<?xml version="1.0" encoding="UTF-8" ?>', file=code)
|
||||||
print("<movie>", 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(" <runtime>" + str(runtime).replace(" ", "") + "</runtime>", file=code)
|
||||||
print(" <director>" + director + "</director>", file=code)
|
print(" <director>" + director + "</director>", file=code)
|
||||||
print(" <poster>" + poster_path + "</poster>", 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)
|
print(" <fanart>" + fanart_path + "</fanart>", file=code)
|
||||||
try:
|
try:
|
||||||
for key in actor_list:
|
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(" <maker>" + studio + "</maker>", file=code)
|
||||||
print(" <label>" + label + "</label>", file=code)
|
print(" <label>" + label + "</label>", file=code)
|
||||||
|
|
||||||
skip_tags = config.getInstance().donot_save_tags()
|
jellyfin = config.getInstance().jellyfin()
|
||||||
if not skip_tags:
|
if not jellyfin:
|
||||||
if config.getInstance().actor_only_tag():
|
if config.getInstance().actor_only_tag():
|
||||||
for key in actor_list:
|
for key in actor_list:
|
||||||
try:
|
try:
|
||||||
@@ -920,7 +927,7 @@ def core_main(movie_path, number_th, oCC, specified_source=None, specified_url=N
|
|||||||
pass
|
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封面图文件名规则
|
# 兼容Jellyfin封面图文件名规则
|
||||||
if multi_part and conf.jellyfin_multi_part_fanart():
|
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():
|
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)
|
_4k)
|
||||||
|
|
||||||
# 兼容Jellyfin封面图文件名规则
|
# 兼容Jellyfin封面图文件名规则
|
||||||
|
|||||||
Reference in New Issue
Block a user