Fix: #912(part 1)

Fix the bug setting the translation title causes the <originaltitle> item in the .NFO to be translated together.
This commit is contained in:
Csrayz
2023-02-19 12:44:58 +08:00
parent e8505a89f6
commit 363b149d05
2 changed files with 10 additions and 2 deletions

View File

@@ -269,14 +269,22 @@ def get_data_from_json(
pass
naming_rule = ""
original_naming_rule = ""
for i in conf.naming_rule().split("+"):
if i not in json_data:
naming_rule += i.strip("'").strip('"')
original_naming_rule += i.strip("'").strip('"')
else:
item = json_data.get(i)
naming_rule += item if type(item) is not list else "&".join(item)
# PATCH处理[title]存在翻译的情况后续NFO文件的original_name只会直接沿用naming_rule,这导致original_name非原始名
# 理应在翻译处处理 naming_rule和original_naming_rule
if i == 'title':
item = json_data.get('original_title')
original_naming_rule += item if type(item) is not list else "&".join(item)
json_data['naming_rule'] = naming_rule
json_data['original_naming_rule'] = original_naming_rule
return json_data