Add batch downloading with NUSD scripts

This commit is contained in:
yeah-its-gloria
2024-10-19 18:07:42 +02:00
parent bc1858a5a5
commit 0dbe28914d
5 changed files with 118 additions and 12 deletions

View File

@@ -3,6 +3,7 @@
import os
import pathlib
from typing import List, Tuple
import libTWLPy
@@ -116,7 +117,7 @@ def run_nus_download_dsi(out_folder: pathlib.Path, tid: str, version: str, pack_
title.tad.set_cert_data(libTWLPy.download_cert())
# Use a typed TAD name if there is one, and auto generate one based on the TID and version if there isn't.
progress_callback.emit("Packing TAD...")
if tad_file_name != "":
if tad_file_name != "" and tad_file_name is not None:
if tad_file_name[-4:] != ".tad":
tad_file_name = tad_file_name + ".tad"
else:
@@ -132,3 +133,13 @@ def run_nus_download_dsi(out_folder: pathlib.Path, tid: str, version: str, pack_
if (not pack_tad_enabled and pack_tad_chkbox) or (not decrypt_contents_enabled and decrypt_contents_chkbox):
return 1
return 0
def run_nus_download_dsi_batch(out_folder: pathlib.Path, titles: List[Tuple[str, str]], pack_tad_chkbox: bool, keep_enc_chkbox: bool,
decrypt_contents_chkbox: bool, use_local_chkbox: bool, progress_callback=None):
for title in titles:
result = run_nus_download_dsi(out_folder, title[0], title[1], pack_tad_chkbox, keep_enc_chkbox, decrypt_contents_chkbox, use_local_chkbox, None, progress_callback)
if result != 0:
return result
progress_callback.emit(f"Batch download finished.")
return 0

View File

@@ -3,6 +3,7 @@
import os
import pathlib
from typing import List, Tuple
import libWiiPy
@@ -138,7 +139,7 @@ def run_nus_download_wii(out_folder: pathlib.Path, tid: str, version: str, pack_
title.wad.set_cert_data(libWiiPy.title.download_cert(wiiu_endpoint=wiiu_nus_enabled))
# Use a typed WAD name if there is one, and auto generate one based on the TID and version if there isn't.
progress_callback.emit(" - Packing WAD...")
if wad_file_name != "":
if wad_file_name != "" and wad_file_name is not None:
if wad_file_name[-4:] != ".wad":
wad_file_name = wad_file_name + ".wad"
else:
@@ -165,3 +166,14 @@ def run_nus_download_wii(out_folder: pathlib.Path, tid: str, version: str, pack_
if (not pack_wad_enabled and pack_wad_chkbox) or (not decrypt_contents_enabled and decrypt_contents_chkbox):
return 1
return 0
def run_nus_download_wii_batch(out_folder: pathlib.Path, titles: List[Tuple[str, str]], pack_wad_chkbox: bool, keep_enc_chkbox: bool,
decrypt_contents_chkbox: bool, wiiu_nus_chkbox: bool, use_local_chkbox: bool,
repack_vwii_chkbox: bool, patch_ios: bool, progress_callback=None):
for title in titles:
result = run_nus_download_wii(out_folder, title[0], title[1], pack_wad_chkbox, keep_enc_chkbox, decrypt_contents_chkbox, wiiu_nus_chkbox, use_local_chkbox, repack_vwii_chkbox, patch_ios, None, progress_callback)
if result != 0:
return result
progress_callback.emit(f"Batch download finished.")
return 0