|
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() |
|
|