def LoadRecent(self): self.cur.execute("SELECT * FROM Recent") rows = self.cur.fetchall() if rows: Recent = [] dif = {3: 'master', 2: 'expert'} for row in rows: Dic = { 'MusicId': row[0], 'Level': row[1], 'MusicName': row[2], 'Image': row[3], 'BaseRate': row[4], 'Score': row[5], 'Rate': row[6], 'PlayDate': row[7], 'Rank': Func.Score2Rank(row[5]), 'LevelName': dif[row[1]] } Recent.append(Dic) return Recent else: return None
def LoadBest(self): self.cur.execute("SELECT * FROM Best") rows = self.cur.fetchall() if rows: Best = [] dif = {3: 'master', 2: 'expert'} for row in rows: Dic = { 'MusicId': row[0], 'Level': row[1], 'MusicName': row[2], 'Image': row[3], 'BaseRate': row[4], 'Score': row[5], 'MaxScore': row[6], 'Rate': row[7], 'Rank': Func.Score2Rank(row[5]), 'LevelName': dif[row[1]], 'Diff': Func.BaseRate2Diff(row[4]) } Best.append(Dic) return Best else: return None