diff --git a/NUSGet.py b/NUSGet.py index c19a90f..ba24bea 100644 --- a/NUSGet.py +++ b/NUSGet.py @@ -396,7 +396,6 @@ class MainWindow(QMainWindow, Ui_MainWindow): except KeyError: archive_name = "" break - print(archive_name) titles.append(BatchTitleData(tid, title_version, console, archive_name)) self.lock_ui_for_download() worker = Worker(run_nus_download_batch, out_folder, titles, self.ui.pack_archive_chkbox.isChecked(), diff --git a/data/wii-database.json b/data/wii-database.json index 94cfce4..52ca14e 100644 --- a/data/wii-database.json +++ b/data/wii-database.json @@ -859,5 +859,17 @@ }, "Ticket": false } + ], + "Virtual Console - NES": [ + { + "Name": "Super Mario Bros.", + "TID": "00010001464147XX", + "Versions": { + "USA/NTSC": [2], + "Europe/PAL": [2], + "Japan": [2] + }, + "Ticket": false + } ] } \ No newline at end of file diff --git a/modules/download_batch.py b/modules/download_batch.py index d01e383..e2083be 100644 --- a/modules/download_batch.py +++ b/modules/download_batch.py @@ -13,22 +13,26 @@ def run_nus_download_batch(out_folder: pathlib.Path, titles: List[BatchTitleData use_local_chkbox: bool, repack_vwii_chkbox: bool, patch_ios: bool, progress_callback=None): for title in titles: + if title.version == -1: + version_str = "Latest" + else: + version_str = str(title.version) if title.console == "Wii" or title.console == "vWii": if title.archive_name != "": - archive_name = f"{title.archive_name}-v{title.version}-{title.console}.wad" + archive_name = f"{title.archive_name}-v{version_str}-{title.console}.wad" else: - archive_name = f"{title.tid}-v{title.version}-{title.console}.wad" - result = run_nus_download_wii(out_folder, title.tid, str(title.version), pack_wad_chkbox, keep_enc_chkbox, + archive_name = f"{title.tid}-v{version_str}-{title.console}.wad" + result = run_nus_download_wii(out_folder, title.tid, version_str, pack_wad_chkbox, keep_enc_chkbox, decrypt_contents_chkbox, wiiu_nus_chkbox, use_local_chkbox, repack_vwii_chkbox, patch_ios, archive_name, progress_callback) if result != 0: return result elif title.console == "DSi": if title.archive_name != "": - archive_name = f"{title.archive_name}-v{title.version}-{title.console}.tad" + archive_name = f"{title.archive_name}-v{version_str}-{title.console}.tad" else: - archive_name = f"{title.tid}-v{title.version}-{title.console}.tad" - result = run_nus_download_dsi(out_folder, title.tid, str(title.version), pack_wad_chkbox, keep_enc_chkbox, + archive_name = f"{title.tid}-v{version_str}-{title.console}.tad" + result = run_nus_download_dsi(out_folder, title.tid, version_str, pack_wad_chkbox, keep_enc_chkbox, decrypt_contents_chkbox, use_local_chkbox, archive_name, progress_callback) if result != 0: return result diff --git a/modules/download_dsi.py b/modules/download_dsi.py index 47f7e86..285acc4 100644 --- a/modules/download_dsi.py +++ b/modules/download_dsi.py @@ -99,6 +99,8 @@ def run_nus_download_dsi(out_folder: pathlib.Path, tid: str, version: str, pack_ # 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 != "" and tad_file_name is not None: + # Batch downloads may insert -vLatest, so if it did we can fill in the real number now. + tad_file_name = tad_file_name.replace("-vLatest", f"-v{title_version}") if tad_file_name[-4:].lower() != ".tad": tad_file_name += ".tad" else: @@ -112,15 +114,3 @@ 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, 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, f"{title[2]}-{title[1]}.tad", - progress_callback) - if result != 0: - return result - progress_callback.emit(f"Batch download finished.") - return 0 diff --git a/modules/download_wii.py b/modules/download_wii.py index 0e436b4..5ee485c 100644 --- a/modules/download_wii.py +++ b/modules/download_wii.py @@ -116,6 +116,8 @@ def run_nus_download_wii(out_folder: pathlib.Path, tid: str, version: str, pack_ # 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 != "" and wad_file_name is not None: + # Batch downloads may insert -vLatest, so if it did we can fill in the real number now. + wad_file_name = wad_file_name.replace("-vLatest", f"-v{title_version}") if wad_file_name[-4:].lower() != ".wad": wad_file_name += ".wad" else: @@ -140,16 +142,3 @@ 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, 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, f"{title[2]}-{title[1]}.wad", progress_callback) - if result != 0: - return result - progress_callback.emit(f"Batch download finished.") - return 0 diff --git a/modules/tree.py b/modules/tree.py index d3df9fd..1df28c0 100644 --- a/modules/tree.py +++ b/modules/tree.py @@ -60,7 +60,9 @@ class NUSGetTreeModel(QAbstractItemModel): tid_item.add_child(region_item) for version in version_list: danger = entry.get("Danger") if entry.get("Danger") is not None else "" - metadata = TitleData(entry.get("TID"), entry.get("Name"), entry.get("Archive Name"), + archive_name = (entry.get("Archive Name") if entry.get("Archive Name") is not None + else entry.get("Name").replace(" ", "-")) + metadata = TitleData(entry.get("TID"), entry.get("Name"), archive_name, version, entry.get("Ticket"), region, key, danger) public_versions = entry.get("Public Versions") if public_versions is not None: @@ -97,11 +99,11 @@ class NUSGetTreeModel(QAbstractItemModel): if role == Qt.DecorationRole and index.column() == 0: # Check for icons based on the "Ticket" metadata only at the TID level if item.parent and item.parent.data_at(0) == "System": - if item.metadata and "Ticket" in item.metadata: - if item.metadata["Ticket"]: - return QIcon.fromTheme("dialog-ok") # Checkmark icon + if item.metadata and item.metadata.ticket: + if item.metadata.ticket: + return QIcon.fromTheme("dialog-ok") else: - return QIcon.fromTheme("dialog-cancel") # X icon + return QIcon.fromTheme("dialog-cancel") return None def headerData(self, section, orientation, role=Qt.DisplayRole):