1
0
mirror of synced 2024-11-14 18:07:36 +01:00
bemaniutils/bemani/utils/iidxutils.py
Jennifer Taylor 509cb4f0d9 Convert most of the format() string calls to f-strings using libcst.
Exact commands run were:

  python3 -m libcst.tool codemod convert_format_to_fstring.ConvertFormatStringCommand . --no-format
  python3 setup.py build_ext --inplace
2020-01-07 21:29:07 +00:00

48 lines
1.2 KiB
Python

import argparse
from bemani.format import IIDXMusicDB
def main() -> None:
parser = argparse.ArgumentParser(description="A utility to patch a IIDX music database.")
parser.add_argument(
"infile",
help="Music DB to work with.",
type=str,
)
parser.add_argument(
"outfile",
help="Music DB to overwrite.",
type=str,
)
parser.add_argument(
"--hide-leggendarias",
help="Hide leggendarias in normal folders.",
action="store_true",
)
args = parser.parse_args()
fp = open(args.infile, 'rb')
data = fp.read()
fp.close()
db = IIDXMusicDB(data)
if args.hide_leggendarias:
for song in db.songs:
if song.title[-1:] == '' or (
song.difficulties[0] == 0 and
song.difficulties[1] == 0 and
song.difficulties[2] == 12
):
print(f'Patching \'{song.title}\' to only appear in leggendaria folder!')
song.folder = 0x5C
print('Generating new database file...')
fp = open(args.outfile, 'wb')
fp.write(db.get_new_db())
fp.close()
if __name__ == '__main__':
main()