Add ISO mark

This commit is contained in:
yoshiko2
2023-06-10 00:40:01 +08:00
parent 13af581e94
commit 449174f0a0

36
core.py
View File

@@ -313,7 +313,7 @@ def image_download(cover, fanart_path, thumb_path, path, filepath, json_headers=
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,
uncensored, hack, hack_word, _4k, fanart_path, poster_path, thumb_path): uncensored, hack, hack_word, _4k, fanart_path, poster_path, thumb_path, iso):
title, studio, year, outline, runtime, director, actor_photo, release, number, cover, trailer, website, series, label = get_info( title, studio, year, outline, runtime, director, actor_photo, release, number, cover, trailer, website, series, label = get_info(
json_data) json_data)
if config.getInstance().main_mode() == 3: # 模式3下由于视频文件不做任何改变.nfo文件必须和视频文件名称除后缀外完全一致KODI等软件方可支持 if config.getInstance().main_mode() == 3: # 模式3下由于视频文件不做任何改变.nfo文件必须和视频文件名称除后缀外完全一致KODI等软件方可支持
@@ -407,6 +407,8 @@ def print_files(path, leak_word, c_word, naming_rule, part, cn_sub, json_data, f
print(" <tag>破解</tag>", file=code) print(" <tag>破解</tag>", file=code)
if _4k: if _4k:
print(" <tag>4k</tag>", file=code) print(" <tag>4k</tag>", file=code)
if iso:
print(" <tag>原盘</tag>", file=code)
for i in tag: for i in tag:
print(" <tag>" + i + "</tag>", file=code) print(" <tag>" + i + "</tag>", file=code)
if cn_sub: if cn_sub:
@@ -481,7 +483,7 @@ def print_files(path, leak_word, c_word, naming_rule, part, cn_sub, json_data, f
return return
def add_mark(poster_path, thumb_path, cn_sub, leak, uncensored, hack, _4k) -> None: def add_mark(poster_path, thumb_path, cn_sub, leak, uncensored, hack, _4k, iso) -> None:
""" """
add watermark on poster or thumb for describe extra properties 给海报和缩略图加属性水印 add watermark on poster or thumb for describe extra properties 给海报和缩略图加属性水印
@@ -503,14 +505,16 @@ def add_mark(poster_path, thumb_path, cn_sub, leak, uncensored, hack, _4k) -> No
mark_type += ',破解' mark_type += ',破解'
if _4k: if _4k:
mark_type += ',4k' mark_type += ',4k'
if iso:
mark_type += ',iso'
if mark_type == '': if mark_type == '':
return return
add_mark_thread(thumb_path, cn_sub, leak, uncensored, hack, _4k) add_mark_thread(thumb_path, cn_sub, leak, uncensored, hack, _4k, iso)
add_mark_thread(poster_path, cn_sub, leak, uncensored, hack, _4k) add_mark_thread(poster_path, cn_sub, leak, uncensored, hack, _4k, iso)
print('[+]Add Mark: ' + mark_type.strip(',')) print('[+]Add Mark: ' + mark_type.strip(','))
def add_mark_thread(pic_path, cn_sub, leak, uncensored, hack, _4k): def add_mark_thread(pic_path, cn_sub, leak, uncensored, hack, _4k, iso):
size = 9 size = 9
img_pic = Image.open(pic_path) img_pic = Image.open(pic_path)
# 获取自定义位置取余配合pos达到顺时针添加的效果 # 获取自定义位置取余配合pos达到顺时针添加的效果
@@ -528,6 +532,8 @@ def add_mark_thread(pic_path, cn_sub, leak, uncensored, hack, _4k):
add_to_pic(pic_path, img_pic, size, count, 4) add_to_pic(pic_path, img_pic, size, count, 4)
if _4k: if _4k:
add_to_pic(pic_path, img_pic, size, count, 5) add_to_pic(pic_path, img_pic, size, count, 5)
if iso:
add_to_pic(pic_path, img_pic, size, count, 6)
img_pic.close() img_pic.close()
@@ -719,6 +725,7 @@ def core_main_no_net_op(movie_path, number):
hack = False hack = False
hack_word = '' hack_word = ''
_4k = False _4k = False
iso = False
imagecut = 1 imagecut = 1
multi = False multi = False
part = '' part = ''
@@ -740,6 +747,11 @@ def core_main_no_net_op(movie_path, number):
hack = True hack = True
hack_word = "-hack" hack_word = "-hack"
if '4k'.upper() in str(movie_path).upper() or '4k' in movie_path:
_4k = True
if '.iso'.upper() in str(movie_path).upper() or '.iso' in movie_path:
iso = True
# try: # try:
# props = get_video_properties(movie_path) # 判断是否为4K视频 # props = get_video_properties(movie_path) # 判断是否为4K视频
@@ -777,7 +789,7 @@ def core_main_no_net_op(movie_path, number):
cutImage(imagecut, path, fanart_path, poster_path, bool(conf.face_uncensored_only() and not uncensored)) cutImage(imagecut, path, fanart_path, poster_path, bool(conf.face_uncensored_only() and not uncensored))
if conf.is_watermark(): if conf.is_watermark():
add_mark(full_poster_path, full_thumb_path, cn_sub, leak, uncensored, hack, _4k) add_mark(full_poster_path, full_thumb_path, cn_sub, leak, uncensored, hack, _4k, iso)
if multi and conf.jellyfin_multi_part_fanart(): if multi and conf.jellyfin_multi_part_fanart():
linkImage(path, number, part, leak_word, c_word, hack_word, ext) linkImage(path, number, part, leak_word, c_word, hack_word, ext)
@@ -820,6 +832,7 @@ def core_main(movie_path, number_th, oCC, specified_source=None, specified_url=N
hack = False hack = False
hack_word = '' hack_word = ''
_4k = False _4k = False
iso = False
# 下面被注释的变量不需要 # 下面被注释的变量不需要
# rootpath = os.getcwd # rootpath = os.getcwd
@@ -867,6 +880,9 @@ def core_main(movie_path, number_th, oCC, specified_source=None, specified_url=N
if '4k'.upper() in str(movie_path).upper() or '4k' in movie_path: if '4k'.upper() in str(movie_path).upper() or '4k' in movie_path:
_4k = True _4k = True
if '.iso'.upper() in str(movie_path).upper() or '.iso' in movie_path:
iso = True
# 判断是否4k # 判断是否4k
if '4K' in tag: if '4K' in tag:
tag.remove('4K') # 从tag中移除'4K' tag.remove('4K') # 从tag中移除'4K'
@@ -959,12 +975,12 @@ 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, add_mark(os.path.join(path, poster_path), os.path.join(path, thumb_path), cn_sub, leak, uncensored,
hack, _4k) hack, _4k, iso)
# 最后输出.nfo元数据文件以完成.nfo文件创建作为任务成功标志 # 最后输出.nfo元数据文件以完成.nfo文件创建作为任务成功标志
print_files(path, leak_word, c_word, json_data.get('naming_rule'), part, cn_sub, json_data, movie_path, tag, 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 json_data.get('actor_list'), liuchu, uncensored, hack, hack_word
, _4k, fanart_path, poster_path, thumb_path) , _4k, fanart_path, poster_path, thumb_path, iso)
elif conf.main_mode() == 2: elif conf.main_mode() == 2:
# 创建文件夹 # 创建文件夹
@@ -1018,7 +1034,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, fanart_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, iso)
# 兼容Jellyfin封面图文件名规则 # 兼容Jellyfin封面图文件名规则
if multi_part and conf.jellyfin_multi_part_fanart(): if multi_part and conf.jellyfin_multi_part_fanart():
@@ -1028,4 +1044,4 @@ def core_main(movie_path, number_th, oCC, specified_source=None, specified_url=N
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, _4k, fanart_path, tag, json_data.get('actor_list'), liuchu, uncensored, hack, hack_word, _4k, fanart_path,
poster_path, poster_path,
thumb_path) thumb_path, iso)