def initThread(app): nut.scan() app.refresh() if Config.autolaunchBrowser: webbrowser.open_new_tab( 'http://' + urllib.parse.quote_plus(Users.first().id) + ':' + urllib.parse.quote_plus(Users.first().password) + '@' + getIpAddress() + ':' + str(Config.server.port))
def getSearch(request, response): nsp = [] nsx = [] nsz = [] xci = [] xcz = [] nut.scan() for _, f in Nsps.files.items(): name = f.fileName() if name is None: continue if name.endswith('.nsp'): nsp.append({ 'id': f.titleId, 'name': f.baseName(), 'version': int(f.version) if f.version else None }) elif name.endswith('.nsz'): nsz.append({ 'id': f.titleId, 'name': f.baseName(), 'version': int(f.version) if f.version else None }) elif name.endswith('.nsx'): nsx.append({ 'id': f.titleId, 'name': f.baseName(), 'version': int(f.version) if f.version else None }) elif name.endswith('.xci'): xci.append({ 'id': f.titleId, 'name': f.baseName(), 'version': int(f.version) if f.version else None }) elif name.endswith('.xcz'): xcz.append({ 'id': f.titleId, 'name': f.baseName(), 'version': int(f.version) if f.version else None }) o = nsz + nsp + xcz + xci + nsx response.write(json.dumps(o))
def getFiles(request, response): global last_scan_datetime if datetime.now() > last_scan_datetime + timedelta( seconds=Config.scanDebounceSeconds): nut.scan() last_scan_datetime = datetime.now() r = {} for path, nsp in Nsps.files.items(): if Titles.contains(nsp.titleId): title = Titles.get(nsp.titleId) if not title.baseId in r: r[title.baseId] = {'base': [], 'dlc': [], 'update': []} if title.isDLC: r[title.baseId]['dlc'].append(nsp.dict()) elif title.isUpdate: r[title.baseId]['update'].append(nsp.dict()) else: r[title.baseId]['base'].append(nsp.dict()) response.write(json.dumps(r))
def getScan(request, response): success(request, response, nut.scan(scanTitles=True))
def initThread(app): nut.scan() app.refresh()
def on_scan(self): #self.model.setRowCount(0) nut.scan() self.files.refresh()
language = args.language or 'en' print( json.dumps( cdn.Shogun.scrapeTitle(int(args.scrape_nsuid), region=region, language=language, force=True).__dict__)) Titles.saveRegion(region, language) if args.usb: try: from nut import Usb except BaseException as e: Print.error('pip3 install pyusb, required for USB coms: ' + str(e)) nut.scan() Usb.daemon() if args.scan: nut.initTitles() nut.initFiles() nut.scan() if args.pull: nut.pull() if args.refresh: nut.initTitles() nut.initFiles() refresh(False)
def initThread(app): print('initThread start') nut.scan() app.refresh() print('initThread finish')
def getScan(request, response): success(request, response, nut.scan())
def on_scan(self): self.tableWidget.setRowCount(0) nut.scan() self.refreshTable()
def initThread(): nut.scan()
def on_scan(self): nut.scan() self.files.refresh()