def addMap(cls, beatmap, category='user'): if cls.exist(beatmap): if category == 'np': return cls.pushMap(beatmap) else: # Let's add map to base, but first, we need to calculate some data... # PP Calculation initializaion... beatmap_data = PP_Calculator.PP_Calculator( 'max', beatmap, f_accs=[0.95, 0.98, 0.99, 1], f_miss=[0, 0, 0, 0]) title = f"{beatmap_data[2][0]} [{beatmap_data[2][1]}]" pps = beatmap_data[1] data = beatmap_data[0] # Insert into table cls.execute( Executor.insert(category, ("beatmap", "title", "pp", "rating", "data"), (beatmap, title, str(pps), 1, str(data))))
def addStat(cls, user: str) -> None: if cls.exists(user): return user_data = us.User() user_data.setUser(user) acc = user_data.acc pp = user_data.pp star_avg = user_data.calcAvgStar() now = round(time()) cls.execute( Executor.insert( "user", ("name", "acc", "pp", "star_avg", "pushed", "last_use"), (user, acc, pp, star_avg, '[]', now)))
def insert_language(self, language: str) -> None: self.execute( Executor.insert("lang", ("name", "lang"), (self.name, language)))