You've already forked PythonLib
mirror of
https://github.com/lifebottle/PythonLib.git
synced 2026-02-13 15:25:50 -08:00
Fmv subs generation
This commit is contained in:
@@ -17,6 +17,7 @@ import pyjson5 as json
|
||||
from tqdm import tqdm
|
||||
|
||||
import pythonlib.formats.rebirth.btlsub_to_hdr as btl_maker
|
||||
import pythonlib.formats.rebirth.fmv_to_hdr as fmv_maker
|
||||
import pythonlib.formats.rebirth.pak2 as pak2lib
|
||||
import pythonlib.utils.comptolib as comptolib
|
||||
from pythonlib.formats.FileIO import FileIO
|
||||
@@ -120,6 +121,23 @@ class ToolsTOR(ToolsTales):
|
||||
print("Done!")
|
||||
|
||||
|
||||
def create_fmv_subs(self):
|
||||
if not self.make_btl_subs:
|
||||
return
|
||||
|
||||
print("Updating FMV sub data...")
|
||||
|
||||
srt_path = self.paths["translated_files"] / "fmv"
|
||||
srts = list(srt_path.glob("*.srt"))
|
||||
|
||||
lines = fmv_maker.generate_header_lines(srts)
|
||||
|
||||
h_file = self.paths["tools"] / "hacks/src/fmv_subs_text.h"
|
||||
with h_file.open("w", encoding="utf8") as f:
|
||||
f.write("\n".join(lines))
|
||||
print("Done!")
|
||||
|
||||
|
||||
def get_build_name(self) -> str:
|
||||
if self.single_build:
|
||||
return "TalesOfRebirth_latest"
|
||||
@@ -447,8 +465,11 @@ class ToolsTOR(ToolsTales):
|
||||
return finalText
|
||||
|
||||
def read_xml(self, xml_path: Path) -> etree._Element:
|
||||
with xml_path.open("r", encoding='utf-8') as xml_file:
|
||||
xml_str = xml_file.read().replace("<EnglishText></EnglishText>", "<EnglishText empty=\"true\"></EnglishText>")
|
||||
try:
|
||||
with xml_path.open("r", encoding='utf-8') as xml_file:
|
||||
xml_str = xml_file.read().replace("<EnglishText></EnglishText>", "<EnglishText empty=\"true\"></EnglishText>")
|
||||
except FileNotFoundError:
|
||||
xml_str = "<SceneText></SceneText>"
|
||||
root = etree.fromstring(xml_str, parser=etree.XMLParser(recover=True))
|
||||
return root
|
||||
|
||||
|
||||
Reference in New Issue
Block a user