WiiPy/modules/nus.py
NinjaCheetah 5e1bf6ed4e
Rewrote entire source to be based around argparse
This does change a large amount of the syntax for using the CLI, but I think that's for the better. This new system also allows for having help pages for each sub command, making the tool a lot easier to use. It also allows for having more arguments available for each subcommand, which is especially necessary for the ASH module.
2024-06-24 00:41:07 -04:00

25 lines
652 B
Python

# "nus.py" from WiiPy by NinjaCheetah
# https://github.com/NinjaCheetah/WiiPy
import libWiiPy
def handle_nus(args):
title_version = None
if args.version is not None:
try:
title_version = int(args.version)
except ValueError:
print("Enter a valid integer for the Title Version.")
return
title = libWiiPy.title.download_title(args.tid, title_version)
file_name = args.tid + "-v" + str(title.tmd.title_version) + ".wad"
wad_file = open(file_name, "wb")
wad_file.write(title.dump_wad())
wad_file.close()
print("Downloaded title with Title ID \"" + args.tid + "\"!")