509cb4f0d9
Exact commands run were: python3 -m libcst.tool codemod convert_format_to_fstring.ConvertFormatStringCommand . --no-format python3 setup.py build_ext --inplace
48 lines
1.2 KiB
Python
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()
|