fixed up updater
This commit is contained in:
parent
77e78a73eb
commit
057273552b
4 changed files with 29 additions and 37 deletions
|
|
@ -18,6 +18,8 @@ def scene_mst(qdb, old_path, dir_in, languages):
|
||||||
|
|
||||||
locations = load_locations(dir_in)
|
locations = load_locations(dir_in)
|
||||||
|
|
||||||
|
print(locations)
|
||||||
|
|
||||||
for id, scene in scenes.items():
|
for id, scene in scenes.items():
|
||||||
i = 0
|
i = 0
|
||||||
while True:
|
while True:
|
||||||
|
|
@ -26,18 +28,14 @@ def scene_mst(qdb, old_path, dir_in, languages):
|
||||||
except KeyError as exc:
|
except KeyError as exc:
|
||||||
i += 1
|
i += 1
|
||||||
if i == len(scene["Parts"]):
|
if i == len(scene["Parts"]):
|
||||||
raise KeyError(
|
raise KeyError(f"Could not find folder for scene {id}") from exc
|
||||||
f"Could not find folder for scene {id}"
|
|
||||||
) from exc
|
|
||||||
continue
|
continue
|
||||||
break
|
break
|
||||||
|
|
||||||
with io.open(
|
with io.open(
|
||||||
os.path.join(old_path, "XduScene.json"), "w", newline="\n"
|
os.path.join(old_path, "XduScene.json"), "w", newline="\n"
|
||||||
) as json_file:
|
) as json_file:
|
||||||
json.dump(
|
json.dump(scenes, json_file, ensure_ascii=False, indent="\t", sort_keys=True)
|
||||||
scenes, json_file, ensure_ascii=False, indent="\t", sort_keys=True
|
|
||||||
)
|
|
||||||
|
|
||||||
for lang in languages:
|
for lang in languages:
|
||||||
out_dict = {}
|
out_dict = {}
|
||||||
|
|
@ -66,11 +64,7 @@ def scene_mst(qdb, old_path, dir_in, languages):
|
||||||
|
|
||||||
with io.open(langfile, "w", newline="\n") as lang_file:
|
with io.open(langfile, "w", newline="\n") as lang_file:
|
||||||
json.dump(
|
json.dump(
|
||||||
out_dict,
|
out_dict, lang_file, ensure_ascii=False, indent="\t", sort_keys=True,
|
||||||
lang_file,
|
|
||||||
ensure_ascii=False,
|
|
||||||
indent="\t",
|
|
||||||
sort_keys=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -80,9 +74,7 @@ def quest_mst(qdb, old_path, languages):
|
||||||
with io.open(
|
with io.open(
|
||||||
os.path.join(old_path, "XduQuest.json"), "w", newline="\n"
|
os.path.join(old_path, "XduQuest.json"), "w", newline="\n"
|
||||||
) as json_file:
|
) as json_file:
|
||||||
json.dump(
|
json.dump(quests, json_file, ensure_ascii=False, indent="\t", sort_keys=True)
|
||||||
quests, json_file, ensure_ascii=False, indent="\t", sort_keys=True
|
|
||||||
)
|
|
||||||
|
|
||||||
for lang in languages:
|
for lang in languages:
|
||||||
out_dict = {}
|
out_dict = {}
|
||||||
|
|
@ -101,11 +93,7 @@ def quest_mst(qdb, old_path, languages):
|
||||||
|
|
||||||
with io.open(langfile, "w", newline="\n") as lang_file:
|
with io.open(langfile, "w", newline="\n") as lang_file:
|
||||||
json.dump(
|
json.dump(
|
||||||
out_dict,
|
out_dict, lang_file, ensure_ascii=False, indent="\t", sort_keys=True,
|
||||||
lang_file,
|
|
||||||
ensure_ascii=False,
|
|
||||||
indent="\t",
|
|
||||||
sort_keys=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return quests
|
return quests
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ def main():
|
||||||
metavar="<command>", title="subcommand", dest="subcommand"
|
metavar="<command>", title="subcommand", dest="subcommand"
|
||||||
)
|
)
|
||||||
parser_xdudata_update = parser_xdudata_subparsers.add_parser(
|
parser_xdudata_update = parser_xdudata_subparsers.add_parser(
|
||||||
"update", help="Update an XDUData directory", parents=[global_flag_parser]
|
"update", help="Update an XDUData directory"
|
||||||
)
|
)
|
||||||
parser_xdudata_update.add_argument(
|
parser_xdudata_update.add_argument(
|
||||||
"CACHE", help="files/ directory from XDU cache", type=str
|
"CACHE", help="files/ directory from XDU cache", type=str
|
||||||
|
|
@ -193,7 +193,6 @@ def main():
|
||||||
args.EXTRACT,
|
args.EXTRACT,
|
||||||
script_dir,
|
script_dir,
|
||||||
LANGUAGES,
|
LANGUAGES,
|
||||||
args.is_global,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,12 @@ def translate_dir(dir_in, tsv_out_dir, json_out_dir, is_global):
|
||||||
if len(files) == 0:
|
if len(files) == 0:
|
||||||
raise FileNotFoundError("No valid files found in directory: " + dir_in)
|
raise FileNotFoundError("No valid files found in directory: " + dir_in)
|
||||||
|
|
||||||
ptrans = partial(translate_file, tsv_out_dir=tsv_out_dir, json_out_dir=json_out_dir)
|
ptrans = partial(
|
||||||
|
translate_file,
|
||||||
|
tsv_out_dir=tsv_out_dir,
|
||||||
|
json_out_dir=json_out_dir,
|
||||||
|
is_global=is_global,
|
||||||
|
)
|
||||||
with Pool() as p:
|
with Pool() as p:
|
||||||
p.map(ptrans, files)
|
p.map(ptrans, files)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,28 +12,21 @@ from glob import glob
|
||||||
|
|
||||||
|
|
||||||
def update_all(
|
def update_all(
|
||||||
cache_dir,
|
cache_dir, update_dir, translation_dir, extract_dir, script_dir, languages,
|
||||||
update_dir,
|
|
||||||
translation_dir,
|
|
||||||
extract_dir,
|
|
||||||
script_dir,
|
|
||||||
languages,
|
|
||||||
is_global,
|
|
||||||
):
|
):
|
||||||
print("Cleaning cache")
|
print("Cleaning cache")
|
||||||
cleanup_cache(cache_dir)
|
cleanup_cache(cache_dir)
|
||||||
|
|
||||||
print("Copying images")
|
print("Copying images")
|
||||||
# copy_images(cache_dir, update_dir)
|
copy_images(cache_dir, update_dir)
|
||||||
|
|
||||||
print("Processing TSV files")
|
print("Processing TSV files")
|
||||||
# TODO
|
update_tsv(cache_dir, update_dir, extract_dir, translation_dir, languages)
|
||||||
# update_tsv(cache_dir, update_dir, translation_dir, languages, is_global)
|
|
||||||
|
|
||||||
print("Processing Quest Json files")
|
print("Processing Quest Json files")
|
||||||
# diva.quest.update_missions(cache_dir, translation_dir, languages)
|
diva.quest.update_missions(extract_dir, translation_dir, languages)
|
||||||
|
|
||||||
# this code isn't going to run on windows (it will in WSL though) because i need to rewrite it
|
# this code isn't going to run on windows (it is in WSL though) because i need to rewrite it
|
||||||
# it just calls my zsh tools and generates it that way, need to replace them
|
# it just calls my zsh tools and generates it that way, need to replace them
|
||||||
# with real python or something
|
# with real python or something
|
||||||
|
|
||||||
|
|
@ -92,7 +85,7 @@ def update_all(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def update_tsv(cache_dir, update_dir, translation_dir, languages, is_global):
|
def update_tsv(cache_dir, update_dir, extract_dir, translation_dir, languages):
|
||||||
utage_tmp = tempfile.mkdtemp()
|
utage_tmp = tempfile.mkdtemp()
|
||||||
copy_tree(os.path.join(cache_dir, "Common/Asset/Utage"), utage_tmp)
|
copy_tree(os.path.join(cache_dir, "Common/Asset/Utage"), utage_tmp)
|
||||||
utage.crypt.crypt_dir(
|
utage.crypt.crypt_dir(
|
||||||
|
|
@ -104,13 +97,20 @@ def update_tsv(cache_dir, update_dir, translation_dir, languages, is_global):
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# copy over files for the quest updater
|
||||||
|
copy_tree(utage_tmp, os.path.join(extract_dir, "Common/Asset/Utage"))
|
||||||
|
shutil.copy2(os.path.join(cache_dir, "QuestMst.db"), extract_dir)
|
||||||
|
shutil.copy2(os.path.join(cache_dir, "QuestSceneMst.db"), extract_dir)
|
||||||
|
shutil.copy2(os.path.join(cache_dir, "QuestPartMst.db"), extract_dir)
|
||||||
|
shutil.copy2(os.path.join(cache_dir, "ResourceEntry.db"), extract_dir)
|
||||||
|
|
||||||
utage.translate.translate_dir(
|
utage.translate.translate_dir(
|
||||||
utage_tmp,
|
utage_tmp,
|
||||||
os.path.join(update_dir, "Utage"),
|
os.path.join(update_dir, "Utage"),
|
||||||
os.path.join(translation_dir, "Missions"),
|
os.path.join(translation_dir, "Missions"),
|
||||||
is_global,
|
False,
|
||||||
)
|
)
|
||||||
utage.names.update_names(utage_tmp, translation_dir, languages)
|
utage.names.update_names(utage_tmp, translation_dir, languages, False)
|
||||||
copy_tree(os.path.join(utage_tmp, "Diva"), os.path.join(update_dir, "Utage/Diva"))
|
copy_tree(os.path.join(utage_tmp, "Diva"), os.path.join(update_dir, "Utage/Diva"))
|
||||||
remove_tree(utage_tmp)
|
remove_tree(utage_tmp)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue