def downloadThread(i): Print.info('starting thread ' + str(i)) global status while Config.isRunning: try: id = Titles.queue.shift() if id and Titles.contains(id): activeDownloads[i] = 1 t = Titles.get(id) path = CDNSP.download_game(t.id.lower(), t.lastestVersion(), t.key, True, '', True) if os.path.isfile(path): nsp = Fs.Nsp(path, None) nsp.move() Nsps.files[nsp.path] = nsp Nsps.save() status.add() activeDownloads[i] = 0 else: time.sleep(1) except KeyboardInterrupt: pass except BaseException as e: Print.error(str(e)) activeDownloads[i] = 0 Print.info('ending thread ' + str(i))
def organize(): initTitles() initFiles() #scan() Print.info('organizing') for k, f in Nsps.files.items(): #print('moving ' + f.path) #Print.info(str(f.hasValidTicket) +' = ' + f.path) f.move() for id, t in Titles.data().items(): files = t.getFiles() if len(files) > 1: #Print.info("%d - %s - %s" % (len(files), t.id, t.name)) latest = t.getLatestFile() if not latest: continue for f in files: if f.path != latest.path: f.moveDupe() Print.info('removing empty directories') Nsps.removeEmptyDir('.', False) Nsps.save()
def organize(): initTitles() initFiles() #scan() print('organizing') for k, f in Nsps.files.items(): #print(str(f.hasValidTicket) +' = ' + f.path) f.move() print('removing empty directories') Nsps.removeEmptyDir('.', False) Nsps.save()