Game line names across languages; RSubtitle; editor in three columns

This commit is contained in:
2026-10-10 02:14:06 +02:00
parent f29af40b37
commit ea3e44000a
40 changed files with 54018 additions and 53559 deletions

View File

@@ -49,11 +49,34 @@ def test_synthetic_catalog_names_and_search(synth_game):
def test_characters_csv_covers_user_lists():
chars = load_characters()
assert len(chars) > 3000
chars = load_characters(lang="ITA")
assert len(chars) > 3000 and len(load_characters()) > 2500 # most labels apply in every language
# the lists name ITA sounds by position (wemscan): NAME_i = variation i of the ITA WAD entry (alias NAME#i)
src = os.path.join(catalog_dir(), "source", "ita", "Joker.txt")
first = open(src).readline().strip()[:-4]
assert "Joker" in chars[first.lower()]
base, i = first.rsplit("_", 1)
ita = read_csv(os.path.join(catalog_dir(), "ITA.csv"))
s = next(s for s in ita if first.lower() in {n.lower() for n in s.names()} or
"%s#%s" % (base, i) in s.aliases)
assert "Joker" in s.character
# every labelled ITA sound keeps its label (takes of one line, NAME#k, share it), and most labels reach INT
assert sum(1 for x in ita if x.character) >= 3366
assert sum(1 for x in read_csv(os.path.join(catalog_dir(), "INT.csv")) if x.character) > 2900
def test_line_names_agree_across_languages_and_subtitles():
"""Speech sounds carry the game's line name: the same names in every language, and a linked subtitle's
sound has the subtitle's line name (positions inside WAD entries differ per language: findings 20)."""
from ackit import subtitles
ita = {s.name for s in read_csv(os.path.join(catalog_dir(), "ITA.csv")) if s.group == "Speech"}
intl = {s.name for s in read_csv(os.path.join(catalog_dir(), "INT.csv")) if s.group == "Speech"}
assert len(ita & intl) > 0.97 * len(ita)
snd = {s.key: s for s in read_csv(os.path.join(catalog_dir(), "ITA.csv"))}
rows = [r for r in subtitles.read_texts(os.path.join(catalog_dir(), "SUB_ITA.csv"), "ITA") if r.sound in snd]
same = sum(1 for r in rows if snd[r.sound].name.split("#")[0] == r.speech)
assert len(rows) > 8000 and same > 0.99 * len(rows)
hdr = next(csv.reader(open(os.path.join(catalog_dir(), "characters.csv"), encoding="utf-8")))
assert hdr == ["name", "character", "language"]
def test_shipped_csvs_are_consistent():
@@ -87,8 +110,8 @@ def test_real_game_uses_shipped_catalog(real_game_dir):
bank = read_csv(os.path.join(catalog_dir(), "BANK.csv"))
assert len(cat.sounds) == 10816 + 651 + sum(1 for s in bank if s.language in ("", "ITA"))
assert {s.language for s in cat.sounds if s.archive == "BANK"} == {"", "ITA"}
s = cat.resolve("Speech_TAPE_JOKER_1_4")
assert s.category == "Interview tapes" and s.size == 44985
s = cat.resolve("Speech_TAPE_JOKER_1#4") # position 4 in the ITA entry (the user's list name)
assert s.category == "Interview tapes" and s.size == 44985 and s.name.startswith("Speech_TAPE_JOKER_1_")
assert len(cat.heads) == 396 and sum(len(v) for v in cat.heads.values()) == 2101
b = cat.resolve("Play_BatmanDeviceImpact_Wood_1")
assert b.archive == "BANK" and b.group == "SFX"