Skip to content

Commit

Permalink
fix: 番号后缀顺序允许设置分辨率 (close #204)
Browse files Browse the repository at this point in the history
  • Loading branch information
sqzw-x committed Jun 5, 2024
1 parent dff05d3 commit daff178
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion config.ini.default
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ naming_file = number
naming_media = number title
prevent_char =
fields_rule = del_actor,del_char,
suffix_sort = mosaic,cnword
suffix_sort = mosaic,cnword,definition
actor_no_name = 未知演员
release_rule = YYYY-MM-DD
folder_name_max = 60
Expand Down
2 changes: 1 addition & 1 deletion src/models/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def update_config(self):
self.official_websites = official_websites_dic

# 字段命名规则-后缀字段顺序
all_str_list = ['mosaic', 'cnword']
all_str_list = ['mosaic', 'cnword', 'definition']
read_str_list = re.split(r'[,,]', self.suffix_sort)
new_str_list1 = [i1 for i1 in read_str_list if i1 in all_str_list] # 去除不在list中的字符
new_str_list = []
Expand Down
4 changes: 2 additions & 2 deletions src/models/config/config_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class GeneratedConfig:
website_suren = r'mgstage,avsex,jav321,freejavbt,7mmtv,javbus,javdb'
website_fc2 = r'fc2,fc2club,fc2hub,freejavbt,7mmtv,hdouban,javdb,avsox,airav'
website_oumei = r'theporndb,javdb,javbus,hdouban'
website_guochan = r'madouqu,mdtv,hdouban,cnmdb'
website_guochan = r'madouqu,mdtv,hdouban,cnmdb,javday'
whole_fields = r'outline,actor,thumb,release,tag,'
none_fields = r'wanted,'
website_set = r'official,'
Expand Down Expand Up @@ -144,7 +144,7 @@ class GeneratedConfig:
naming_media = r'number title'
prevent_char = r''
fields_rule = r'del_actor,del_char,'
suffix_sort = r'mosaic,cnword'
suffix_sort = r'mosaic,cnword,definition'
actor_no_name = r'未知演员'
release_rule = r'YYYY-MM-DD'
folder_name_max = 60
Expand Down
20 changes: 10 additions & 10 deletions src/models/core/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,16 +575,16 @@ def _get_folder_path(file_path, success_folder, json_data):
m_word = ''

# 判断后缀字段顺序
file_show_name = number + temp_4k
suffix_sort_list = config.suffix_sort.split(',')
for each in suffix_sort_list:
if each == 'mosaic':
file_show_name += m_word
number += m_word
elif each == 'cnword':
file_show_name += c_word
number += c_word
elif each == "definition":
number += temp_4k

# 生成number
number = file_show_name
first_letter = get_number_first_letter(number)

# 特殊情况处理
Expand Down Expand Up @@ -672,7 +672,7 @@ def _get_folder_path(file_path, success_folder, json_data):
return folder_new_path.strip().replace(' /', '/')


def _get_naming_rule(file_path, json_data):
def _generate_file_name(file_path, json_data):
file_full_name = split_path(file_path)[1]
file_name, file_ex = os.path.splitext(file_full_name)
filename = file_name
Expand Down Expand Up @@ -719,16 +719,16 @@ def _get_naming_rule(file_path, json_data):
m_word = ''

# 判断后缀字段顺序
file_show_name = number + temp_4k
suffix_sort_list = config.suffix_sort.split(',')
for each in suffix_sort_list:
if each == 'mosaic':
file_show_name += m_word
number += m_word
elif each == 'cnword':
file_show_name += c_word
number += c_word
elif each == "definition":
number += temp_4k

# 生成number
number = file_show_name
first_letter = get_number_first_letter(number)

# 处理异常情况
Expand Down Expand Up @@ -826,7 +826,7 @@ def get_output_name(json_data, file_path, success_folder, file_ex):
folder_new_path = _get_folder_path(file_path, success_folder, json_data)
folder_new_path = _deal_path_name(folder_new_path)
# =====================================================================================更新实体文件命名规则
naming_rule = _get_naming_rule(file_path, json_data)
naming_rule = _generate_file_name(file_path, json_data)
naming_rule = _deal_path_name(naming_rule)
# =====================================================================================生成文件和nfo新路径
file_new_name = naming_rule + file_ex.lower()
Expand Down

0 comments on commit daff178

Please sign in to comment.