File size: 1,307 Bytes
df03d35 1bb0419 df03d35 1bb0419 df03d35 1bb0419 df03d35 1bb0419 df03d35 1bb0419 df03d35 1bb0419 df03d35 1bb0419 df03d35 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
from ks_parse.__main__ import parse_file
from attrs import define
import argparse
from pathlib import Path
@define
class Volume:
name: str
stype: str
ALL_VOLUMES = [
Volume(name="2015-sssa", stype="novel"),
Volume(name="2016a-yubikiri", stype="novel"),
Volume(name="2016b-sssa2", stype="novel"),
Volume(name="2017-otomari", stype="novel"),
Volume(name="2018-harem", stype="adv"),
Volume(name="2019-aiyoku", stype="adv"),
Volume(name="2020-yuuwaku", stype="adv"),
Volume(name="2022-mainichi", stype="adv"),
]
BASE = Path("./scenario-raw")
if __name__ == "__main__":
argp = argparse.ArgumentParser()
argp.add_argument(
"ks_base", type=Path, help="Base directory of .ks files, e.g. ./scenario-raw"
)
argp.add_argument(
"output_base",
type=Path,
help="Base directory of output .jsonl files, e.g. ./scenario",
)
argp.add_argument("--voice", action="store_true", help="Include voice file name")
args = argp.parse_args()
for vol in ALL_VOLUMES:
print(f"Processing {vol.name}...", end="")
for ks_path in sorted((args.ks_base / vol.name).glob("*.ks")):
print(f" {ks_path.stem}", end="")
parse_file(ks_path, args.output_base, vol.stype, args.voice)
print()
|