mirror of
https://github.com/NinjaCheetah/WiiPy.git
synced 2025-04-26 21:31:02 -04:00
Added simple NUS downloading interface
This commit is contained in:
parent
c3111aaf7a
commit
ceb7b38fa1
10
main.py
10
main.py
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
from modules.wad import *
|
from modules.wad import *
|
||||||
|
from modules.nus import *
|
||||||
|
|
||||||
opts = [opt for opt in sys.argv[1:] if opt.startswith("-")]
|
opts = [opt for opt in sys.argv[1:] if opt.startswith("-")]
|
||||||
args = [arg for arg in sys.argv[1:] if not arg.startswith("-")]
|
args = [arg for arg in sys.argv[1:] if not arg.startswith("-")]
|
||||||
@ -18,5 +19,14 @@ if __name__ == "__main__":
|
|||||||
pack_wad_from_folder(args[1], args[2])
|
pack_wad_from_folder(args[1], args[2])
|
||||||
exit(0)
|
exit(0)
|
||||||
raise SystemExit(f"Usage: {sys.argv[0]} WAD (-u | -p) <input> <output>")
|
raise SystemExit(f"Usage: {sys.argv[0]} WAD (-u | -p) <input> <output>")
|
||||||
|
elif "NUS" in args:
|
||||||
|
if "-d" in opts:
|
||||||
|
if len(args) == 2:
|
||||||
|
download_title(args[1])
|
||||||
|
exit(0)
|
||||||
|
elif len(args) == 3:
|
||||||
|
download_title(args[1], args[2])
|
||||||
|
exit(0)
|
||||||
|
raise SystemExit(f"Usage: {sys.argv[0]} NUS -d <Title ID> <Title Version (Optional)>")
|
||||||
else:
|
else:
|
||||||
raise SystemExit(f"Usage: {sys.argv[0]} WAD (-u | -p) <input> <output>")
|
raise SystemExit(f"Usage: {sys.argv[0]} WAD (-u | -p) <input> <output>")
|
||||||
|
22
modules/nus.py
Normal file
22
modules/nus.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# "nus.py" from libWiiPy-cli by NinjaCheetah
|
||||||
|
# https://github.com/NinjaCheetah/libWiiPy-cli
|
||||||
|
|
||||||
|
import libWiiPy
|
||||||
|
|
||||||
|
|
||||||
|
def download_title(title_id: str, title_version_input: str = None):
|
||||||
|
title_version = None
|
||||||
|
if title_version_input is not None:
|
||||||
|
try:
|
||||||
|
title_version = int(title_version_input)
|
||||||
|
except ValueError:
|
||||||
|
print("Enter a valid integer for the Title Version.")
|
||||||
|
return
|
||||||
|
|
||||||
|
title = libWiiPy.download_title(title_id, title_version)
|
||||||
|
|
||||||
|
file_name = title_id + "-v" + str(title.tmd.title_version) + ".wad"
|
||||||
|
|
||||||
|
wad_file = open(file_name, "wb")
|
||||||
|
wad_file.write(title.dump_wad())
|
||||||
|
wad_file.close()
|
@ -1,2 +1 @@
|
|||||||
git+https://github.com/NinjaCheetah/libWiiPy
|
git+https://github.com/NinjaCheetah/libWiiPy
|
||||||
pycryptodome
|
|
Loading…
x
Reference in New Issue
Block a user