Exemplo n.º 1
0
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))
Exemplo n.º 2
0
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))
Exemplo n.º 3
0
Arquivo: Api.py Projeto: zhentan/nut
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))
Exemplo n.º 4
0
def getScan(request, response):
    success(request, response, nut.scan(scanTitles=True))
Exemplo n.º 5
0
def initThread(app):
	nut.scan()
	app.refresh()
Exemplo n.º 6
0
	def on_scan(self):
		#self.model.setRowCount(0)
		nut.scan()
		self.files.refresh()
Exemplo n.º 7
0
Arquivo: nut.py Projeto: blawar/nut
                    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)
Exemplo n.º 8
0
def initThread(app):
	print('initThread start')
	nut.scan()
	app.refresh()
	print('initThread finish')
Exemplo n.º 9
0
def getScan(request, response):
    success(request, response, nut.scan())
Exemplo n.º 10
0
Arquivo: server.py Projeto: jasii/nut
 def on_scan(self):
     self.tableWidget.setRowCount(0)
     nut.scan()
     self.refreshTable()
Exemplo n.º 11
0
def initThread():
    nut.scan()
Exemplo n.º 12
0
 def on_scan(self):
     nut.scan()
     self.files.refresh()