sorting out zsh script calling and folder names
This commit is contained in:
parent
d761d12c63
commit
77e78a73eb
6 changed files with 79 additions and 51 deletions
|
|
@ -1,4 +1,7 @@
|
|||
from contextlib import suppress
|
||||
|
||||
import diva
|
||||
import shutil
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
|
@ -8,35 +11,59 @@ from distutils.dir_util import copy_tree, remove_tree
|
|||
from glob import glob
|
||||
|
||||
|
||||
def update_all(cache_dir, update_dir, translation_dir, extract_dir, languages):
|
||||
def update_all(
|
||||
cache_dir,
|
||||
update_dir,
|
||||
translation_dir,
|
||||
extract_dir,
|
||||
script_dir,
|
||||
languages,
|
||||
is_global,
|
||||
):
|
||||
print("Cleaning cache")
|
||||
cleanup_cache(cache_dir)
|
||||
|
||||
print("Copying images")
|
||||
copy_images(cache_dir, update_dir)
|
||||
# copy_images(cache_dir, update_dir)
|
||||
|
||||
print("Processing TSV files")
|
||||
update_tsv(cache_dir, update_dir, translation_dir, languages)
|
||||
# TODO
|
||||
# update_tsv(cache_dir, update_dir, translation_dir, languages, is_global)
|
||||
|
||||
print("Processing Quest Json files")
|
||||
diva.quest.update_missions(cache_dir, translation_dir, languages)
|
||||
# diva.quest.update_missions(cache_dir, translation_dir, languages)
|
||||
|
||||
# this code isn't going to run on windows because i need to rewrite it
|
||||
# it just calls my zsh scripts and generates it that way, need to replace them
|
||||
# this code isn't going to run on windows (it will in WSL though) because i need to rewrite it
|
||||
# it just calls my zsh tools and generates it that way, need to replace them
|
||||
# with real python or something
|
||||
|
||||
# first copy over the necessary avtools to the extract dir
|
||||
# TODO make it so that you don't need to copy them over (for example call them with python)
|
||||
print("Copying necessary tools into extracting directory")
|
||||
shutil.copy2(os.path.join(script_dir, "acb_extract.exe"), extract_dir)
|
||||
shutil.copy2(os.path.join(script_dir, "usm_extract.exe"), extract_dir)
|
||||
shutil.copy2(os.path.join(script_dir, "clHCA"), extract_dir)
|
||||
|
||||
print("Processing Sound Effects")
|
||||
copy_tree(
|
||||
os.path.join(cache_dir, "Android/Asset/Sound/Se"),
|
||||
os.path.join(extract_dir, "Se"),
|
||||
)
|
||||
subprocess.run("./update_se.zsh", shell=True, cwd=extract_dir)
|
||||
copy_tree(os.path.join(extract_dir, "se"), os.path.join(update_dir, "Se"))
|
||||
subprocess.run(
|
||||
os.path.join(script_dir, "update_se.zsh"), shell=True, cwd=extract_dir
|
||||
)
|
||||
copy_tree(os.path.join(extract_dir, "se_extracted"), os.path.join(update_dir, "Se"))
|
||||
|
||||
print("Processing BGM - don't forget to copy that loop file")
|
||||
copy_tree(
|
||||
os.path.join(cache_dir, "Android/Asset/Sound/Bgm"),
|
||||
os.path.join(extract_dir, "Bgm"),
|
||||
)
|
||||
subprocess.run("./update_bgm.zsh", shell=True, cwd=extract_dir)
|
||||
subprocess.run(
|
||||
os.path.join(script_dir, "update_bgm.zsh"), shell=True, cwd=extract_dir
|
||||
)
|
||||
copy_tree(
|
||||
os.path.join(extract_dir, "bgm"), os.path.join(update_dir, "Bgm")
|
||||
os.path.join(extract_dir, "bgm_extracted"), os.path.join(update_dir, "Bgm")
|
||||
)
|
||||
|
||||
print("Processing voices")
|
||||
|
|
@ -44,9 +71,11 @@ def update_all(cache_dir, update_dir, translation_dir, extract_dir, languages):
|
|||
os.path.join(cache_dir, "Android/Asset/Sound/Voice"),
|
||||
os.path.join(extract_dir, "Voice"),
|
||||
)
|
||||
subprocess.run("./update_voice.zsh", shell=True, cwd=extract_dir)
|
||||
subprocess.run(
|
||||
os.path.join(script_dir, "update_voice.zsh"), shell=True, cwd=extract_dir
|
||||
)
|
||||
copy_tree(
|
||||
os.path.join(extract_dir, "voice"), os.path.join(update_dir, "Voice")
|
||||
os.path.join(extract_dir, "voice_extracted"), os.path.join(update_dir, "Voice")
|
||||
)
|
||||
|
||||
print("Processing movies - this might take forever")
|
||||
|
|
@ -54,22 +83,22 @@ def update_all(cache_dir, update_dir, translation_dir, extract_dir, languages):
|
|||
os.path.join(cache_dir, "Common/Asset/Movie"),
|
||||
os.path.join(extract_dir, "Movie"),
|
||||
)
|
||||
subprocess.run("./update_movie.zsh", shell=True, cwd=extract_dir)
|
||||
subprocess.run(
|
||||
os.path.join(script_dir, "update_movie.zsh"), shell=True, cwd=extract_dir
|
||||
)
|
||||
copy_tree(
|
||||
os.path.join(extract_dir, "movie"),
|
||||
os.path.join(extract_dir, "movie_extracted"),
|
||||
os.path.join(update_dir, "Asset/Movie"),
|
||||
)
|
||||
|
||||
|
||||
def update_tsv(cache_dir, update_dir, translation_dir, languages):
|
||||
def update_tsv(cache_dir, update_dir, translation_dir, languages, is_global):
|
||||
utage_tmp = tempfile.mkdtemp()
|
||||
copy_tree(os.path.join(cache_dir, "Common/Asset/Utage"), utage_tmp)
|
||||
utage.crypt.crypt_dir(
|
||||
utage_tmp, bytearray("SampleSecretKey", "utf-8"), False, False
|
||||
)
|
||||
for encrypted in glob(
|
||||
os.path.join(utage_tmp, "**/*.utage"), recursive=True
|
||||
):
|
||||
for encrypted in glob(os.path.join(utage_tmp, "**/*.utage"), recursive=True):
|
||||
try:
|
||||
os.remove(encrypted)
|
||||
except:
|
||||
|
|
@ -79,11 +108,10 @@ def update_tsv(cache_dir, update_dir, translation_dir, languages):
|
|||
utage_tmp,
|
||||
os.path.join(update_dir, "Utage"),
|
||||
os.path.join(translation_dir, "Missions"),
|
||||
is_global,
|
||||
)
|
||||
utage.names.update_names(utage_tmp, translation_dir, languages)
|
||||
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)
|
||||
|
||||
|
||||
|
|
@ -93,6 +121,15 @@ def copy_images(cache_dir, update_dir):
|
|||
os.path.join(update_dir, "Asset/Image"),
|
||||
)
|
||||
copy_tree(
|
||||
os.path.join(cache_dir, "Common/Sample"),
|
||||
os.path.join(update_dir, "Sample"),
|
||||
os.path.join(cache_dir, "Common/Sample"), os.path.join(update_dir, "Sample"),
|
||||
)
|
||||
|
||||
|
||||
def cleanup_cache(cache_dir):
|
||||
with suppress(FileNotFoundError):
|
||||
shutil.rmtree(os.path.join(cache_dir, "Common/Asset/Utage/event32"))
|
||||
os.remove(
|
||||
os.path.join(
|
||||
cache_dir, "Common/Asset/Utage/side01/Scenario/Sheet2.tsv.utage"
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue