Skip to content

Commit

Permalink
Fix: nfo文件写入错误空格;手动设置演员写入nfo文件
Browse files Browse the repository at this point in the history
  • Loading branch information
runoob11 committed Feb 1, 2024
1 parent 8d6cd7e commit fc88133
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/models/core/nfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ def write_nfo(json_data, nfo_new_path, folder_new_path, file_path, edit_mode=Fal
nfo_title = config.naming_media
if not number:
number = title
#默认emby视频标题配置为 [number title],国产重复时需去掉一个,去重需注意空格也应一起去掉,否则国产的nfo标题中会多一个空格
#读取nfo title信息会去掉前面的number和空格以保留title展示出来,同时number和标题一致时,去掉number的逻辑变成去掉整个标题导致读取失败,见424行
if number == title and 'number' in nfo_title and 'title' in nfo_title:
nfo_title = nfo_title.replace('originaltitle', '').replace('title', '')
nfo_title = nfo_title.replace('originaltitle', '').replace('title', '').strip()
first_letter = get_number_first_letter(number)

# 处理演员
Expand Down Expand Up @@ -204,20 +206,22 @@ def write_nfo(json_data, nfo_new_path, folder_new_path, file_path, edit_mode=Fal
# 输出国家
if 'country,' in nfo_include_new:
print(f" <countrycode>{country}</countrycode>", file=code)


#初始化 actor_list
actor_list = []
# 输出男女演员
if 'actor_all,' in nfo_include_new:
actor = all_actor
# 有演员时输出演员
if 'actor,' in nfo_include_new and actor and actor not in ['未知演员','未知演員']:
if 'actor,' in nfo_include_new and actor:
actor_list = actor.split(',') # 字符串转列表
actor_list = [actor.strip() for actor in actor_list if actor.strip()] # 去除空白
# 无演员时输出演员 以文件命名设置中未知演员设置项为演员名,默认设置和空值不写入NFO
elif not actor_list and config.actor_no_name not in ["未知演员",'未知演員','']:
elif 'actor,' in nfo_include_new and config.actor_no_name not in ["未知演员",'未知演員','']:
actor = config.actor_no_name
actor_list = actor.split(',') # 字符串转列表
actor_list = [actor.strip() for actor in actor_list if actor.strip()] # 去除空白
signal.add_log(f'⛑️ 无演员名, 使用手动设置项 🛠未知演员 写入NFO {config.actor_no_name}')
signal.add_log(f'⛑️ 无演员名, 使用手动命名 写入NFO {config.actor_no_name}')
if actor_list:
for each in actor_list:
print(" <actor>", file=code)
Expand Down

0 comments on commit fc88133

Please sign in to comment.