mirror of
https://github.com/NinjaCheetah/NUSGet.git
synced 2026-01-09 03:35:59 -05:00
Fix automatic update check
Also updated copyright dates to 2024-2026!
This commit is contained in:
parent
d3c39c022a
commit
e4b5f184c6
30
NUSGet.py
30
NUSGet.py
@ -1,5 +1,5 @@
|
|||||||
# "NUSGet.py", licensed under the MIT license
|
# "NUSGet.py", licensed under the MIT license
|
||||||
# Copyright 2024-2025 NinjaCheetah and Contributors
|
# Copyright 2024-2026 NinjaCheetah and Contributors
|
||||||
|
|
||||||
# Nuitka options. These determine compilation settings based on the current OS.
|
# Nuitka options. These determine compilation settings based on the current OS.
|
||||||
# nuitka-project-if: {OS} == "Darwin":
|
# nuitka-project-if: {OS} == "Darwin":
|
||||||
@ -39,9 +39,9 @@ from modules.download_batch import run_nus_download_batch
|
|||||||
from modules.download_wii import run_nus_download_wii
|
from modules.download_wii import run_nus_download_wii
|
||||||
from modules.download_dsi import run_nus_download_dsi
|
from modules.download_dsi import run_nus_download_dsi
|
||||||
|
|
||||||
nusget_version = "1.5.0"
|
NUSGET_VERSION = "1.5.1"
|
||||||
|
|
||||||
regions = {"World": ["41"], "USA/NTSC": ["45"], "Europe/PAL": ["50"], "Japan": ["4A"], "Korea": ["4B"], "China": ["43"],
|
REGIONS = {"World": ["41"], "USA/NTSC": ["45"], "Europe/PAL": ["50"], "Japan": ["4A"], "Korea": ["4B"], "China": ["43"],
|
||||||
"Australia/NZ": ["55"]}
|
"Australia/NZ": ["55"]}
|
||||||
|
|
||||||
|
|
||||||
@ -247,9 +247,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||||||
save_config(config_data)
|
save_config(config_data)
|
||||||
if auto_update:
|
if auto_update:
|
||||||
# Do a quick check to see if there's a newer release available if auto-updates are enabled.
|
# Do a quick check to see if there's a newer release available if auto-updates are enabled.
|
||||||
worker = Worker(check_nusget_updates, app, nusget_version)
|
worker = Worker(check_nusget_updates, app, NUSGET_VERSION)
|
||||||
worker.signals.result.connect(self.prompt_for_update)
|
worker.signals.result.connect(self.prompt_for_update)
|
||||||
worker.signals.progress.connect(self.update_log_text)
|
worker.signals.progress.connect(self.progress_update)
|
||||||
self.threadpool.start(worker)
|
self.threadpool.start(worker)
|
||||||
|
|
||||||
def title_double_clicked(self, index):
|
def title_double_clicked(self, index):
|
||||||
@ -287,7 +287,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||||||
return
|
return
|
||||||
self.ui.patch_ios_checkbox.setEnabled(False)
|
self.ui.patch_ios_checkbox.setEnabled(False)
|
||||||
|
|
||||||
def download_progress_update(self, done, total, log_text):
|
def progress_update(self, done, total, log_text):
|
||||||
if done == 0 and total == 0:
|
if done == 0 and total == 0:
|
||||||
self.ui.progress_bar.setRange(0, 0)
|
self.ui.progress_bar.setRange(0, 0)
|
||||||
elif done == -1 and total == -1:
|
elif done == -1 and total == -1:
|
||||||
@ -316,10 +316,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||||||
msg_box.setDefaultButton(QMessageBox.StandardButton.Yes)
|
msg_box.setDefaultButton(QMessageBox.StandardButton.Yes)
|
||||||
msg_box.setWindowTitle(app.translate("MainWindow", "NUSGet Update Available"))
|
msg_box.setWindowTitle(app.translate("MainWindow", "NUSGet Update Available"))
|
||||||
msg_box.setText(app.translate("MainWindow", "<b>There's a newer version of NUSGet available!</b>"))
|
msg_box.setText(app.translate("MainWindow", "<b>There's a newer version of NUSGet available!</b>"))
|
||||||
msg_box.setInformativeText(app.translate("MainWindow", "You're currently running v{nusget_version}, "
|
msg_box.setInformativeText(app.translate("MainWindow", "You're currently running v{NUSGET_VERSION}, "
|
||||||
"but v{new_version} is available on GitHub. Would you like to view"
|
"but v{new_version} is available on GitHub. Would you like to view"
|
||||||
" the latest version?"
|
" the latest version?"
|
||||||
.format(nusget_version=nusget_version, new_version=new_version)))
|
.format(NUSGET_VERSION=NUSGET_VERSION, new_version=new_version)))
|
||||||
ret = msg_box.exec()
|
ret = msg_box.exec()
|
||||||
if ret == QMessageBox.StandardButton.Yes:
|
if ret == QMessageBox.StandardButton.Yes:
|
||||||
webbrowser.open("https://github.com/NinjaCheetah/NUSGet/releases/latest")
|
webbrowser.open("https://github.com/NinjaCheetah/NUSGet/releases/latest")
|
||||||
@ -329,8 +329,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||||||
# If the last two characters are "XX", then this title has multiple regions, and each region uses its own
|
# If the last two characters are "XX", then this title has multiple regions, and each region uses its own
|
||||||
# two-digit code. Use the region info passed to load the correct code.
|
# two-digit code. Use the region info passed to load the correct code.
|
||||||
if selected_title.tid[-2:] == "XX":
|
if selected_title.tid[-2:] == "XX":
|
||||||
global regions
|
global REGIONS
|
||||||
region_code = regions[selected_title.region][0]
|
region_code = REGIONS[selected_title.region][0]
|
||||||
tid = selected_title.tid[:-2] + region_code
|
tid = selected_title.tid[:-2] + region_code
|
||||||
else:
|
else:
|
||||||
tid = selected_title.tid
|
tid = selected_title.tid
|
||||||
@ -440,7 +440,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||||||
self.ui.pack_vwii_mode_checkbox.isChecked(), self.ui.patch_ios_checkbox.isChecked(),
|
self.ui.pack_vwii_mode_checkbox.isChecked(), self.ui.patch_ios_checkbox.isChecked(),
|
||||||
self.ui.archive_file_entry.text())
|
self.ui.archive_file_entry.text())
|
||||||
worker.signals.result.connect(self.check_download_result)
|
worker.signals.result.connect(self.check_download_result)
|
||||||
worker.signals.progress.connect(self.download_progress_update)
|
worker.signals.progress.connect(self.progress_update)
|
||||||
self.threadpool.start(worker)
|
self.threadpool.start(worker)
|
||||||
|
|
||||||
def check_download_result(self, result):
|
def check_download_result(self, result):
|
||||||
@ -584,8 +584,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||||||
for category in target_database:
|
for category in target_database:
|
||||||
for t in target_database[category]:
|
for t in target_database[category]:
|
||||||
if t["TID"][-2:] == "XX":
|
if t["TID"][-2:] == "XX":
|
||||||
for r in regions:
|
for r in REGIONS:
|
||||||
if f"{t['TID'][:-2]}{regions[r][0]}" == tid:
|
if f"{t['TID'][:-2]}{REGIONS[r][0]}" == tid:
|
||||||
try:
|
try:
|
||||||
archive_name = t["Name"].replace(" ", "-")
|
archive_name = t["Name"].replace(" ", "-")
|
||||||
break
|
break
|
||||||
@ -610,7 +610,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||||||
self.ui.use_wiiu_nus_checkbox.isChecked(), self.ui.use_local_checkbox.isChecked(),
|
self.ui.use_wiiu_nus_checkbox.isChecked(), self.ui.use_local_checkbox.isChecked(),
|
||||||
self.ui.pack_vwii_mode_checkbox.isChecked(), self.ui.patch_ios_checkbox.isChecked())
|
self.ui.pack_vwii_mode_checkbox.isChecked(), self.ui.patch_ios_checkbox.isChecked())
|
||||||
worker.signals.result.connect(self.check_batch_result)
|
worker.signals.result.connect(self.check_batch_result)
|
||||||
worker.signals.progress.connect(self.download_progress_update)
|
worker.signals.progress.connect(self.progress_update)
|
||||||
self.threadpool.start(worker)
|
self.threadpool.start(worker)
|
||||||
|
|
||||||
def open_output_dir(self):
|
def open_output_dir(self):
|
||||||
@ -692,7 +692,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||||||
return out_folder
|
return out_folder
|
||||||
|
|
||||||
def about_nusget(self):
|
def about_nusget(self):
|
||||||
about_box = AboutNUSGet([nusget_version, version("libWiiPy"), version("libTWLPy")])
|
about_box = AboutNUSGet([NUSGET_VERSION, version("libWiiPy"), version("libTWLPy")])
|
||||||
about_box.exec()
|
about_box.exec()
|
||||||
|
|
||||||
def change_language(self, new_lang):
|
def change_language(self, new_lang):
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# "build_translations.py", licensed under the MIT license
|
# "build_translations.py", licensed under the MIT license
|
||||||
# Copyright 2024-2025 NinjaCheetah
|
# Copyright 2024-2026 NinjaCheetah & Contributors
|
||||||
# This script exists to work around an issue in PySide6 where the "pyside6-project build" command incorrectly places
|
# This script exists to work around an issue in PySide6 where the "pyside6-project build" command incorrectly places
|
||||||
# translation files in the root of the project directory while building.
|
# translation files in the root of the project directory while building.
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# "modules/config.py", licensed under the MIT license
|
# "modules/config.py", licensed under the MIT license
|
||||||
# Copyright 2024-2025 NinjaCheetah & Contributors
|
# Copyright 2024-2026 NinjaCheetah & Contributors
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# "modules/core.py", licensed under the MIT license
|
# "modules/core.py", licensed under the MIT license
|
||||||
# Copyright 2024-2025 NinjaCheetah & Contributors
|
# Copyright 2024-2026 NinjaCheetah & Contributors
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
@ -69,9 +69,11 @@ def fixup_qmenu_background(menu):
|
|||||||
|
|
||||||
def check_nusget_updates(app, current_version: str, progress_callback=None) -> str | None:
|
def check_nusget_updates(app, current_version: str, progress_callback=None) -> str | None:
|
||||||
# Simple function to make a request to the GitHub API and then check if the latest available version is newer.
|
# Simple function to make a request to the GitHub API and then check if the latest available version is newer.
|
||||||
|
print("checking for updates...")
|
||||||
gh_api_request = requests.get(url="https://api.github.com/repos/NinjaCheetah/NUSGet/releases/latest", stream=True)
|
gh_api_request = requests.get(url="https://api.github.com/repos/NinjaCheetah/NUSGet/releases/latest", stream=True)
|
||||||
if gh_api_request.status_code != 200:
|
if gh_api_request.status_code != 200:
|
||||||
progress_callback.emit(app.translate("MainWindow", "\n\nCould not check for updates."))
|
progress_callback.emit(-1, -1, app.translate("MainWindow", "\n\nCould not check for updates."))
|
||||||
|
print(f"update check failed, status code: {gh_api_request.status_code}")
|
||||||
else:
|
else:
|
||||||
api_response = gh_api_request.json()
|
api_response = gh_api_request.json()
|
||||||
new_version: str = api_response["tag_name"].replace('v', '')
|
new_version: str = api_response["tag_name"].replace('v', '')
|
||||||
@ -79,9 +81,13 @@ def check_nusget_updates(app, current_version: str, progress_callback=None) -> s
|
|||||||
current_version_split = current_version.split('.')
|
current_version_split = current_version.split('.')
|
||||||
for place in range(len(new_version_split)):
|
for place in range(len(new_version_split)):
|
||||||
if new_version_split[place] < current_version_split[place]:
|
if new_version_split[place] < current_version_split[place]:
|
||||||
|
progress_callback.emit(-1, -1, "\n\nYou're running a development version of NUSGet.")
|
||||||
|
print("no update available, this is a development version")
|
||||||
return None
|
return None
|
||||||
elif new_version_split[place] > current_version_split[place]:
|
elif new_version_split[place] > current_version_split[place]:
|
||||||
progress_callback.emit(app.translate("MainWindow", "\n\nThere's a newer version of NUSGet available!"))
|
progress_callback.emit(-1, -1, app.translate("MainWindow", "\n\nThere's a newer version of NUSGet available!"))
|
||||||
|
print("update available")
|
||||||
return new_version
|
return new_version
|
||||||
progress_callback.emit(app.translate("MainWindow", "\n\nYou're running the latest release of NUSGet."))
|
progress_callback.emit(-1, -1, app.translate("MainWindow", "\n\nYou're running the latest release of NUSGet."))
|
||||||
|
print("no update available")
|
||||||
return None
|
return None
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# "modules/download_batch.py", licensed under the MIT license
|
# "modules/download_batch.py", licensed under the MIT license
|
||||||
# Copyright 2024-2025 NinjaCheetah
|
# Copyright 2024-2026 NinjaCheetah & Contributors
|
||||||
|
|
||||||
import pathlib
|
import pathlib
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# "modules/download_dsi.py", licensed under the MIT license
|
# "modules/download_dsi.py", licensed under the MIT license
|
||||||
# Copyright 2024-2025 NinjaCheetah
|
# Copyright 2024-2026 NinjaCheetah & Contributors
|
||||||
|
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
@ -76,11 +76,11 @@ def run_nus_download_dsi(out_folder: pathlib.Path, tid: str, version: str, pack_
|
|||||||
content = libTWLPy.download_content(tid, title.tmd.content_record.content_id)
|
content = libTWLPy.download_content(tid, title.tmd.content_record.content_id)
|
||||||
progress_callback.emit(-1, -1, " - Done!")
|
progress_callback.emit(-1, -1, " - Done!")
|
||||||
# If keep encrypted contents is on, write out the content after its downloaded.
|
# If keep encrypted contents is on, write out the content after its downloaded.
|
||||||
if keep_enc_chkbox is True:
|
if keep_enc_chkbox:
|
||||||
version_dir.joinpath(content_file_name).write_bytes(content)
|
version_dir.joinpath(content_file_name).write_bytes(content)
|
||||||
title.content.content = content
|
title.content.content = content
|
||||||
# If decrypt local contents is still true, decrypt the content and write out the decrypted file.
|
# If decrypt local contents is still true, decrypt the content and write out the decrypted file.
|
||||||
if decrypt_contents_enabled is True:
|
if decrypt_contents_enabled:
|
||||||
try:
|
try:
|
||||||
progress_callback.emit(-1, -1, f" - Decrypting content (Content ID: {title.tmd.content_record.content_id})...")
|
progress_callback.emit(-1, -1, f" - Decrypting content (Content ID: {title.tmd.content_record.content_id})...")
|
||||||
dec_content = title.get_content()
|
dec_content = title.get_content()
|
||||||
@ -91,7 +91,7 @@ def run_nus_download_dsi(out_folder: pathlib.Path, tid: str, version: str, pack_
|
|||||||
# local encrypted contents that have been altered at present.
|
# local encrypted contents that have been altered at present.
|
||||||
return -3
|
return -3
|
||||||
# If pack TAD is still true, pack the TMD, ticket, and content into a TAD.
|
# If pack TAD is still true, pack the TMD, ticket, and content into a TAD.
|
||||||
if pack_tad_enabled is True:
|
if pack_tad_enabled:
|
||||||
# Get the TAD certificate chain, courtesy of libTWLPy.
|
# Get the TAD certificate chain, courtesy of libTWLPy.
|
||||||
progress_callback.emit(-1, -1, " - Building certificate...")
|
progress_callback.emit(-1, -1, " - Building certificate...")
|
||||||
title.tad.set_cert_data(libTWLPy.download_cert())
|
title.tad.set_cert_data(libTWLPy.download_cert())
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# "modules/download_wii.py", licensed under the MIT license
|
# "modules/download_wii.py", licensed under the MIT license
|
||||||
# Copyright 2024-2025 NinjaCheetah & Contributors
|
# Copyright 2024-2026 NinjaCheetah & Contributors
|
||||||
|
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
@ -85,11 +85,11 @@ def run_nus_download_wii(out_folder: pathlib.Path, tid: str, version: str, pack_
|
|||||||
wiiu_endpoint=wiiu_nus_enabled, progress=progress_update))
|
wiiu_endpoint=wiiu_nus_enabled, progress=progress_update))
|
||||||
progress_callback.emit(-1, -1, " - Done!")
|
progress_callback.emit(-1, -1, " - Done!")
|
||||||
# If keep encrypted contents is on, write out each content after its downloaded.
|
# If keep encrypted contents is on, write out each content after its downloaded.
|
||||||
if keep_enc_chkbox is True:
|
if keep_enc_chkbox:
|
||||||
version_dir.joinpath(content_file_name).write_bytes(content_list[content])
|
version_dir.joinpath(content_file_name).write_bytes(content_list[content])
|
||||||
title.content.content_list = content_list
|
title.content.content_list = content_list
|
||||||
# If decrypt local contents is still true, decrypt each content and write out the decrypted file.
|
# If decrypt local contents is still true, decrypt each content and write out the decrypted file.
|
||||||
if decrypt_contents_enabled is True:
|
if decrypt_contents_enabled:
|
||||||
try:
|
try:
|
||||||
for content in range(len(title.tmd.content_records)):
|
for content in range(len(title.tmd.content_records)):
|
||||||
progress_callback.emit(-1, -1, f" - Decrypting content {content + 1} of {len(title.tmd.content_records)} "
|
progress_callback.emit(-1, -1, f" - Decrypting content {content + 1} of {len(title.tmd.content_records)} "
|
||||||
@ -102,7 +102,7 @@ def run_nus_download_wii(out_folder: pathlib.Path, tid: str, version: str, pack_
|
|||||||
# local encrypted contents that have been altered at present.
|
# local encrypted contents that have been altered at present.
|
||||||
return -3
|
return -3
|
||||||
# If pack WAD is still true, pack the TMD, ticket, and contents all into a WAD.
|
# If pack WAD is still true, pack the TMD, ticket, and contents all into a WAD.
|
||||||
if pack_wad_enabled is True:
|
if pack_wad_enabled:
|
||||||
# If the option to pack for vWii mode instead of Wii U mode is enabled, then the Title Key needs to be
|
# If the option to pack for vWii mode instead of Wii U mode is enabled, then the Title Key needs to be
|
||||||
# re-encrypted with the common key instead of the vWii key, so that the title can be installed from within
|
# re-encrypted with the common key instead of the vWii key, so that the title can be installed from within
|
||||||
# vWii mode. (vWii mode does not have access to the vWii key, only Wii U mode has that.)
|
# vWii mode. (vWii mode does not have access to the vWii key, only Wii U mode has that.)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# "modules/language.py", licensed under the MIT license
|
# "modules/language.py", licensed under the MIT license
|
||||||
# Copyright 2024-2025 NinjaCheetah & Contributors
|
# Copyright 2024-2026 NinjaCheetah & Contributors
|
||||||
|
|
||||||
from modules.config import update_setting
|
from modules.config import update_setting
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# "modules/theme.py", licensed under the MIT license
|
# "modules/theme.py", licensed under the MIT license
|
||||||
# Copyright 2024-2025 NinjaCheetah & Contributors
|
# Copyright 2024-2026 NinjaCheetah & Contributors
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# "modules/tree.py", licensed under the MIT license
|
# "modules/tree.py", licensed under the MIT license
|
||||||
# Copyright 2024-2025 NinjaCheetah
|
# Copyright 2024-2026 NinjaCheetah & Contributors
|
||||||
|
|
||||||
from modules.core import TitleData
|
from modules.core import TitleData
|
||||||
from PySide6.QtCore import QAbstractItemModel, QModelIndex, Qt, QSortFilterProxyModel
|
from PySide6.QtCore import QAbstractItemModel, QModelIndex, Qt, QSortFilterProxyModel
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# "qt/py/ui_AboutDialog.py", licensed under the MIT license
|
# "qt/py/ui_AboutDialog.py", licensed under the MIT license
|
||||||
# Copyright 2024-2025 NinjaCheetah and Contributors
|
# Copyright 2024-2026 NinjaCheetah and Contributors
|
||||||
# Thanks Isla and Alex for making such a nice about dialog that I could then "borrow" :p
|
# Thanks Isla and Alex for making such a nice about dialog that I could then "borrow" :p
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@ -46,7 +46,7 @@ class AboutNUSGet(QDialog):
|
|||||||
libraries_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
libraries_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||||
|
|
||||||
# Copyright
|
# Copyright
|
||||||
copyright_label = QLabel(self.tr("© 2024-2025 NinjaCheetah & Contributors"))
|
copyright_label = QLabel(self.tr("© 2024-2026 NinjaCheetah & Contributors"))
|
||||||
copyright_label.setProperty("class", "copyright")
|
copyright_label.setProperty("class", "copyright")
|
||||||
copyright_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
copyright_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# "update_translations.py", licensed under the MIT license
|
# "update_translations.py", licensed under the MIT license
|
||||||
# Copyright 2024-2025 NinjaCheetah
|
# Copyright 2024-2026 NinjaCheetah & Contributors
|
||||||
# This script exists to work around an issue in PySide6 where the "pyside6-project lupdate" command doesn't work as
|
# This script exists to work around an issue in PySide6 where the "pyside6-project lupdate" command doesn't work as
|
||||||
# expected, as it struggles to parse the paths in the .pyproject file. This does what it's meant to do for it.
|
# expected, as it struggles to parse the paths in the .pyproject file. This does what it's meant to do for it.
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user