Exemple #1
0
def run():
    urllib3.disable_warnings()

    print(r'                        ,;:;;,')
    print(r'                       ;;;;;')
    print(r'               .=\',    ;:;;:,')
    print(r'              /_\', "=. \';:;:;')
    print(r'              @=:__,  \,;:;:\'')
    print(r'                _(\.=  ;:;;\'')
    print(r'               `"_(  _/="`')
    print(r'                `"\'')

    nut.initTitles()
    nut.initFiles()

    Hook.init()

    app = QApplication(sys.argv)
    app.setWindowIcon(QIcon('images/logo.jpg'))
    ex = App()

    threads = []
    threads.append(threading.Thread(target=initThread, args=[ex]))
    threads.append(threading.Thread(target=usbThread, args=[]))
    threads.append(threading.Thread(target=nutThread, args=[]))

    for t in threads:
        t.start()

    sys.exit(app.exec_())

    print('fin')
Exemple #2
0
def moveFile(path, newPath):
    path = os.path.abspath(path)
    newPath = os.path.abspath(newPath)

    if path == newPath:
        return False

    if path not in files:
        return registerFile(newPath)

    nsp = files[path]

    nsp.setPath(newPath)
    files[newPath] = nsp
    del files[path]

    Hook.call("files.move", nsp, path)
    return True
Exemple #3
0
def unregisterFile(path):
    path = os.path.abspath(path)
    if path not in files:
        return False

    nsp = files[path]

    if nsp.titleId and nsp.titleId in Title.fileLUT:
        # Title.fileLUT[nsp.titleId].remove(nsp)
        if nsp.titleId in Title.fileLUT:
            Title.fileLUT[nsp.titleId] = [
                item for item in Title.fileLUT[nsp.titleId]
                if item.path != nsp.path
            ]
    del files[path]

    Hook.call("files.unregister", nsp)
    return True
Exemple #4
0
def registerFile(path, registerLUT=True):
    path = os.path.abspath(path)

    if not path in files:
        nsp = Fs.factory(path, path, None)
        nsp.timestamp = time.time()
        nsp.getFileSize()

        files[path] = nsp

        Hook.call("files.register", nsp)
    else:
        nsp = files[path]

    if registerLUT and nsp.titleId:
        if nsp.titleId not in Title.fileLUT:
            Title.fileLUT[nsp.titleId] = []

        if nsp not in Title.fileLUT[nsp.titleId]:
            Title.fileLUT[nsp.titleId].append(nsp)

    return nsp
Exemple #5
0
		sendTitleCard(channelId, nsp.titleId, nsp)

def deleteFile(nsp):
	start()

	if nsp.path.lower().endswith('.xci') or nsp.path.lower().endswith('.xcz'):
		channelIds = Config.original['discord']['channels']['files']['xci']
	elif nsp.isUpdate():
		channelIds = Config.original['discord']['channels']['files']['update']
	elif nsp.isDLC():
		channelIds = Config.original['discord']['channels']['files']['dlc']
	else:
		channelIds = Config.original['discord']['channels']['files']['base']

	for channelId in channelIds:
		sendTitleCard(channelId, nsp.titleId, nsp)

def cleanup():
	if not ready:
		return

	coro = client.close()
	fut = asyncio.run_coroutine_threadsafe(coro, client.loop)

if Config.original['discord']['token']:
	Hook.register('files.move', moveFile)
	Hook.register('files.register', addFile)
	Hook.register('files.unregister', deleteFile)
	Hook.register('exit', cleanup)

Exemple #6
0
                parser.add_argument('--get-dauth-token',
                                    action="store_true",
                                    help='Get dauth token')
                parser.add_argument('--eshop-latest',
                                    action="store_true",
                                    help='List newest eshop titles')
                parser.add_argument('--cetk', help='Pull ticket by rightsID')
                parser.add_argument('--cdn-cache-only',
                                    action="store_true",
                                    help='Only hit cdn cache')
                parser.add_argument(
                    '--cdn-save-languages',
                    action="store_true",
                    help='store language / region data from cdn')

            Hook.init()
            Hook.call("args.pre", parser)

            args = parser.parse_args()

            if hasCdn:
                if args.cdn_cache_only:
                    Config.cdnCacheOnly = True

            if args.hostname:
                args.server = True
                Config.server.hostname = args.hostname

            if args.port:
                args.server = True
                Config.server.port = int(args.port)
Exemple #7
0
    print(r'                _(\.=  ;:;;\'')
    print(r'               `"_(  _/="`')
    print(r'                `"\'')

    nut.initTitles()
    nut.initFiles()

    Hook.init()

    app = QApplication(sys.argv)
    app.setWindowIcon(QIcon('images/logo.jpg'))
    ex = App()

    threads = []
    threads.append(threading.Thread(target=initThread, args=[ex]))
    threads.append(threading.Thread(target=usbThread, args=[]))
    threads.append(threading.Thread(target=nutThread, args=[]))

    for t in threads:
        t.start()

    sys.exit(app.exec_())

    print('fin')


if __name__ == '__main__':
    run()

Hook.call("exit")
Exemple #8
0
    with open(args.import_title_keys, 'r') as f:
        for line in f.read().split('\n'):
            if '=' not in line:
                continue
            try:
                rightsId, key = line.split('=')
                rightsId = rightsId.strip()
                titleId = rightsId[0:16]
                key = key.strip()
                title = Titles.get(titleId)

                nsp = title.getLatestNsp()
                nsz = title.getLatestNsz()
                print(nsp)
                if not nsp and not nsz:
                    Print.info('title import: new title detected: %s - %s' %
                               (title.id, title.name))
                elif not title.key:
                    Print.info(
                        'title import: new title key detected: %s - %s' %
                        (title.id, title.name))
                title.rightsId = rightsId
                title.key = key
            except:
                raise
    Titles.save()


Hook.register('args.pre', parse)
Hook.register('args.post', post)