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)
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)