Add: image naming with number

This commit is contained in:
yoshiko2
2022-11-24 01:31:17 +08:00
parent 65e3cf98b0
commit 9db0ba27ef
3 changed files with 26 additions and 9 deletions

View File

@@ -43,9 +43,10 @@ retry=3
cacert_file= cacert_file=
[Name_Rule] [Name_Rule]
location_rule=actor+'/'+number location_rule = actor+'/'+number
naming_rule=number+'-'+title naming_rule = number+'-'+title
max_title_len=50 max_title_len = 50
image_naming_with_number = 0
[update] [update]
update_check=1 update_check=1

View File

@@ -328,6 +328,12 @@ class Config:
except: except:
return 50 return 50
def image_naming_with_number(self) -> bool:
try:
return self.conf.getboolean("Name_Rule", "image_naming_with_number")
except:
return False
def update_check(self) -> bool: def update_check(self) -> bool:
try: try:
return self.conf.getboolean("update", "update_check") return self.conf.getboolean("update", "update_check")

10
core.py
View File

@@ -758,6 +758,10 @@ def core_main_no_net_op(movie_path, number):
return return
else: else:
return return
fanart_path = f"fanart{ext}"
poster_path = f"poster{ext}"
thumb_path = f"thumb{ext}"
if config.getInstance().image_naming_with_number():
fanart_path = f"{prestr}-fanart{ext}" fanart_path = f"{prestr}-fanart{ext}"
poster_path = f"{prestr}-poster{ext}" poster_path = f"{prestr}-poster{ext}"
thumb_path = f"{prestr}-thumb{ext}" thumb_path = f"{prestr}-thumb{ext}"
@@ -850,9 +854,15 @@ def core_main(movie_path, number_th, oCC, specified_source=None, specified_url=N
cover = json_data.get('cover') cover = json_data.get('cover')
ext = image_ext(cover) ext = image_ext(cover)
fanart_path = f"fanart{ext}"
poster_path = f"poster{ext}"
thumb_path = f"thumb{ext}"
if config.getInstance().image_naming_with_number():
fanart_path = f"{number}{leak_word}{c_word}{hack_word}-fanart{ext}" fanart_path = f"{number}{leak_word}{c_word}{hack_word}-fanart{ext}"
poster_path = f"{number}{leak_word}{c_word}{hack_word}-poster{ext}" poster_path = f"{number}{leak_word}{c_word}{hack_word}-poster{ext}"
thumb_path = f"{number}{leak_word}{c_word}{hack_word}-thumb{ext}" thumb_path = f"{number}{leak_word}{c_word}{hack_word}-thumb{ext}"
# main_mode # main_mode
# 1: 刮削模式 / Scraping mode # 1: 刮削模式 / Scraping mode
# 2: 整理模式 / Organizing mode # 2: 整理模式 / Organizing mode