Skip to content

Commit 4e6c7d2

Browse files
committed
Updated NUS download command for latest libWiiPy changes
1 parent eeb3387 commit 4e6c7d2

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

commands/title/nus.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ def handle_nus_title(args):
4747

4848
# Announce the title being downloaded, and the version if applicable.
4949
if title_version is not None:
50-
print("Downloading title " + tid + " v" + str(title_version) + ", please wait...")
50+
print(f"Downloading title {tid} v{title_version}, please wait...")
5151
else:
52-
print("Downloading title " + tid + " vLatest, please wait...")
52+
print(f"Downloading title {tid} vLatest, please wait...")
5353
print(" - Downloading and parsing TMD...")
5454
# Download a specific TMD version if a version was specified, otherwise just download the latest TMD.
5555
if title_version is not None:
@@ -59,7 +59,7 @@ def handle_nus_title(args):
5959
title_version = title.tmd.title_version
6060
# Write out the TMD to a file.
6161
if output_dir is not None:
62-
output_dir.joinpath("tmd." + str(title_version)).write_bytes(title.tmd.dump())
62+
output_dir.joinpath(f"tmd.{title_version}").write_bytes(title.tmd.dump())
6363

6464
# Download the ticket, if we can.
6565
print(" - Downloading and parsing Ticket...")
@@ -83,10 +83,9 @@ def handle_nus_title(args):
8383
content_file_name = hex(title.tmd.content_records[content].content_id)[2:]
8484
while len(content_file_name) < 8:
8585
content_file_name = "0" + content_file_name
86-
print(" - Downloading content " + str(content + 1) + " of " +
87-
str(len(title.tmd.content_records)) + " (Content ID: " +
88-
str(title.tmd.content_records[content].content_id) + ", Size: " +
89-
str(title.tmd.content_records[content].content_size) + " bytes)...")
86+
print(f" - Downloading content {content + 1} of {len(title.tmd.content_records)} "
87+
f"(Content ID: {title.tmd.content_records[content].content_id}, "
88+
f"Size: {title.tmd.content_records[content].content_size} bytes)...")
9089
content_list.append(libWiiPy.title.download_content(tid, title.tmd.content_records[content].content_id,
9190
wiiu_endpoint=wiiu_nus_enabled))
9291
print(" - Done!")
@@ -99,8 +98,8 @@ def handle_nus_title(args):
9998
if output_dir is not None:
10099
if can_decrypt is True:
101100
for content in range(len(title.tmd.content_records)):
102-
print(" - Decrypting content " + str(content + 1) + " of " + str(len(title.tmd.content_records)) +
103-
" (Content ID: " + str(title.tmd.content_records[content].content_id) + ")...")
101+
print(f" - Decrypting content {content + 1} of {len(title.tmd.content_records)} "
102+
f"(Content ID: {title.tmd.content_records[content].content_id})...")
104103
dec_content = title.get_content_by_index(content)
105104
content_file_name = f"{title.tmd.content_records[content].content_id:08X}".lower() + ".app"
106105
output_dir.joinpath(content_file_name).write_bytes(dec_content)
@@ -111,15 +110,15 @@ def handle_nus_title(args):
111110
if wad_file is not None:
112111
# Get the WAD certificate chain.
113112
print(" - Building certificate...")
114-
title.wad.set_cert_data(libWiiPy.title.download_cert(wiiu_endpoint=wiiu_nus_enabled))
113+
title.load_cert_chain(libWiiPy.title.download_cert_chain(wiiu_endpoint=wiiu_nus_enabled))
115114
# Ensure that the path ends in .wad, and add that if it doesn't.
116115
print("Packing WAD...")
117116
if wad_file.suffix != ".wad":
118117
wad_file = wad_file.with_suffix(".wad")
119118
# Have libWiiPy dump the WAD, and write that data out.
120119
pathlib.Path(wad_file).write_bytes(title.dump_wad())
121120

122-
print("Downloaded title with Title ID \"" + args.tid + "\"!")
121+
print(f"Downloaded title with Title ID \"{args.tid}\"!")
123122

124123

125124
def handle_nus_content(args):
@@ -151,7 +150,7 @@ def handle_nus_content(args):
151150
fatal_error("You must specify the version that the requested content belongs to for decryption!")
152151

153152
# Try to download the content, and catch the ValueError libWiiPy will throw if it can't be found.
154-
print("Downloading content with Content ID " + cid + "...")
153+
print(f"Downloading content with Content ID {cid}...")
155154
content_data = None
156155
try:
157156
content_data = libWiiPy.title.download_content(tid, content_id)

0 commit comments

Comments
 (0)