mirror of
https://github.com/NinjaCheetah/NUSGet.git
synced 2025-04-25 07:01:01 -04:00
Improved WAD name formatting for batch downloads
Also started working on a fix for the checkmark/X icons denoting a ticket not appearing anymore.
This commit is contained in:
parent
6660e129a8
commit
87da32d62e
@ -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(),
|
||||
|
@ -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
|
||||
}
|
||||
]
|
||||
}
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user