Skip to content
This repository has been archived by the owner on Jun 4, 2020. It is now read-only.

Commit

Permalink
v6.0.1 update
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob123a1 authored Oct 24, 2018
1 parent 47d5dcc commit 5a2219c
Showing 1 changed file with 83 additions and 25 deletions.
108 changes: 83 additions & 25 deletions CDNSP-GUI-Bob.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Design inspiration: Lucas Rey's GUI (https://darkumbra.net/forums/topic/174470-app-cdnsp-gui-v105-download-nsp-gamez-using-a-gui/)
# Thanks to the developer(s) that worked on CDNSP_Next for the cert fix!
# Thanks to the help of devloper NighTime, kvn1351, gizmomelb, theLorknessMonster, vertigo
# CDNSP - GUI - Bob - v6.0.0
# CDNSP - GUI - Bob - v6.0.1
import sys
import time
import random
Expand All @@ -15,7 +15,7 @@
import json
import os

__gui_version__ = "6.0.0"
__gui_version__ = "6.0.1"
__lang_version__ = "1.0.0"

global sys_locale
Expand Down Expand Up @@ -732,7 +732,10 @@ def get_versions(tid):
## url = 'https://tagaya.hac.%s.eshop.nintendo.net/tagaya/hac_versionlist' % env
url = 'https://superfly.hac.%s.d4c.nintendo.net/v1/t/%s/dv' % (env,tid)
r = make_request('GET', url)
j = r.json()
try:
j = r.json()
except AttributeError:
return "none"
print(j)

try:
Expand Down Expand Up @@ -1839,7 +1842,7 @@ def __init__(self, root, titleID, titleKey, title, dbURL, info_list=None):
self.entry = Entry(game_selection_frame, textvariable=self.search_var, width=entryWidth)
self.entry.grid(row=0, column=0, columnspan=2, sticky=N)

# Setup Listbox and scrollbar
# Setup Scrollbar
self.scrollbar = Scrollbar(game_selection_frame)
## self.scrollbar.grid(row=1, column=1, sticky=N+S+W)
self.title_list = Listbox(game_selection_frame, exportselection = False,\
Expand Down Expand Up @@ -2074,7 +2077,9 @@ def sortby(self, tree, col, descending):
# if the data to be sorted is numeric change to float
#data = change_numeric(data)
# now sort the data in place

data.sort(reverse=descending)

for ix, item in enumerate(data):
self.tree.move(item[1], '', ix)
# switch the heading so it will sort in the opposite direction
Expand Down Expand Up @@ -3138,25 +3143,43 @@ def threaded_update_titlekeys(self):
r = requests.get(titlekey_url, allow_redirects=True, verify=False)
if str(r.history) == "[<Response [302]>]" and str(r.status_code) == "200":
r.encoding = "utf-8"
newdb = r.text.split('\n')
newdb = r.text.replace("\r", "").split('\n')
if newdb[-1] == "":
newdb = newdb[:-1]
if os.path.isfile(titlekey_file_name):
with open(titlekey_file_name,encoding="utf8") as f:
with open(titlekey_file_name, encoding="utf8") as f:
currdb = f.read().split('\n')
if currdb[-1] == "":
currdb = currdb[:-1]
currdb = [x.strip() for x in currdb]
counter = 0
info = ''
new_tid = []

if self.current_mode == "Nut":
found_line = False
# Find the header info
for line in newdb:
if line[0] != "#" and line[:2] == "id" and current_mode_global == "Nut":
line = line.strip()
found_line = True
header_list = line.split("|")
index_tid = find_index(header_list, "id")
index_title = find_index(header_list, "name")
break


if not found_line:
print("\n"+"Error: Header is not found in the Nut_titlekeys.txt file, please double check you have the header")
sys.exit()

for line in newdb:
if line[0:2] == "01":
if line.strip() not in currdb:
if line.strip() != newdb[0].strip():
new_tid.append(line.strip().split('|')[0])
if current_mode_global == "Nut":
_name = line.strip().split('|')[4] + '\n'
_name = line.strip().split('|')[index_title] + '\n'
if _name not in info:
info += _name
else:
Expand Down Expand Up @@ -3388,7 +3411,7 @@ def get_update_ver(self):

if not tid.endswith("00"):
update_list.append("0")

update_list = update_list[::-1]
update_list.insert(0, _("Latest"))
self.version_select["values"] = update_list
self.version_select.set(_("Latest"))
Expand Down Expand Up @@ -3546,7 +3569,7 @@ def my_game_scan(self, a_dir=None, silent=False):

for root, dirs, files in os.walk(a_dir):
for basename in files:
if basename.endswith(".nsp"):
if basename.endswith(".nsp") or basename.endswith(".xci"):
game_list.append(basename)
if not os.path.isdir("Config"):
os.mkdir("Config")
Expand Down Expand Up @@ -3780,6 +3803,7 @@ def credit_gui(self):
Portuguese: KazumaKiryu#7300
Chinese Simplified: Dolur#7867
Chinese Traditional: Maruku#7128
CZech: -Spider86-#7530
Japanese: Jinoshi(ジノシ)#4416
Korean: RoutineFree#4012
Spanish: pordeciralgo#3603
Expand Down Expand Up @@ -3919,17 +3943,19 @@ def unlock_nsx_scan(self):

temp_tid = []
temp_tkey = []

notified = False
with open("titlekeys.txt", "r", encoding="utf-8") as file:
for line in file.readlines():
line = line.strip()
try:
titleID, titleKey, title = line.split("|")
except:
print(_("Check if there's extra spaces at the bottom of your titlekeys.txt file! Delete if you do!"))
if not notified:
print(_("Check if there's extra spaces at the bottom of your titlekeys.txt file! Delete if you do!"))
notified = True
if len(titleID) == 16 or len(titleID) == 32:
if titleID != "":
temp_tid.append(titleID[:16])
temp_tid.append(titleID[:16].lower())
temp_tkey.append(titleKey)
unlocked_a_game = False # Check if a game has been unlocked
for game in game_list:
Expand Down Expand Up @@ -4076,9 +4102,9 @@ def check_update(self):
ver_list = file.readlines()
file.close()


gui_ver, lang_ver = ver_list

gui_ver = gui_ver.strip()
lang_ver = lang_ver.strip()

Expand Down Expand Up @@ -4162,6 +4188,13 @@ def download_update(self):
# ------------------------
# Main Section

def find_index(header_list, text):
if text in header_list:
return header_list.index(text)
else:
print("Couldn't match the header text: {} in the header provided".format(text))
sys.exit()

def read_titlekey_list():
titleID_list = []
titleKey_list = []
Expand All @@ -4171,15 +4204,18 @@ def read_titlekey_list():
if current_mode_global == "CDNSP":
f = open("titlekeys.txt", "r", encoding="utf8")
content = f.readlines()
notified = False
for i in range(len(content)):
titleID = ""
try:
titleID, titleKey, title = content[i].split("|")
except:
print(_("Check if there's extra spaces at the bottom of your titlekeys.txt file! Delete if you do!"))
if not notified:
print(_("Check if there's extra spaces at the bottom of your titlekeys.txt file! Delete if you do!"))
notified = True
if len(titleID) == 16 or len(titleID) == 32:
if titleID != "":
titleID_list.append(titleID[:16])
titleID_list.append(titleID[:16].lower())
titleKey_list.append(titleKey)
if title[:-1] == "\n":
title_list.append(title[:-1])
Expand All @@ -4191,14 +4227,37 @@ def read_titlekey_list():
info_list = []
f = open("Nut_titlekeys.txt", "r", encoding="utf8")
content = f.readlines()

found_line = False
# Find the header info
for line in content:
if line[0] != "#" and line[:2] == "id":
line = line.strip()
found_line = True
header_list = line.split("|")
index_tid = find_index(header_list, "id")
index_key = find_index(header_list, "key")
index_title = find_index(header_list, "name")
index_isDemo = find_index(header_list, "isDemo")
index_region = find_index(header_list, "region")
break


if not found_line:
print("\n"+"Error: Header is not found in the Nut_titlekeys.txt file, please double check you have the header")
sys.exit()

notified = False
for i in range(len(content)):
titleID = ""
if content[i][0] == "0" and content[i][1] == "1":
if content[i][0:2] == "01":
try:
content_row = content[i].split("|")
except:
print(_("Check if there's extra spaces at the bottom of your titlekeys.txt file! Delete if you do!"))
titleID = content_row[0].lower()
if not notified:
print(_("Check if there's extra spaces at the bottom of your Nut_titlekeys.txt file! Delete if you do!"))
notified = True
titleID = content_row[index_tid].lower()
if len(titleID) == 32:
titleID = titleID[:16]
if len(titleID) == 16 or len(titleID) == 32:
Expand All @@ -4207,22 +4266,21 @@ def read_titlekey_list():
if titleID not in unique_tid_list:
unique_tid_list.append(titleID)
if titleID != "":
titleKey = content_row[2]
titleKey = content_row[index_key]
if len(titleKey) == 32:
title = content_row[4]
isDemo = content_row[3]
title = content_row[index_title]
isDemo = content_row[index_isDemo]
if not titleID.endswith("00"):
title = "[DLC] " + title
if isDemo == "1":
title += " Demo"
titleID_list.append(titleID[:16])
titleID_list.append(titleID[:16].lower())
titleKey_list.append(titleKey)
if title[:-1] == "\n":
title_list.append(title[:-1])
else:
title_list.append(title)
isDemo = content_row[3]
region = content_row[5]
region = content_row[index_region]
info_list.append((isDemo, region))
f.close()

Expand Down

8 comments on commit 5a2219c

@hurley42388
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey Bob23a1, Im new here just wanted to know i downloaded your recent v6.0.1 and im trying to download
a game but i cant seem to it keep saying at the command prompt
error unable to make request without token
any help with be appreciated thank you

@erpazzo78
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error unable to make request without token
any help with be appreciated thank you
THANK YOU

@erpazzo78
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solution to download files.
THANK YOU

@Bob123a1
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if you are up to date with the latest switch news, but downloading isn't possible anymore for the public since a few weeks ago when Nintendo made some changes

@erpazzo78
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so in the end what is the purpose of this update?

@erpazzo78
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to update the games as I do since I banned the game? thanks

@Bob123a1
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For you to find out which one of your game is out of date so you can go and find the NSP files for the new update version

@erpazzo78
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to update the games as I do since I banned the game? thanks

Please sign in to comment.