本文整理汇总了Python中track.Track.votes方法的典型用法代码示例。如果您正苦于以下问题:Python Track.votes方法的具体用法?Python Track.votes怎么用?Python Track.votes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类track.Track
的用法示例。
在下文中一共展示了Track.votes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_all_tracks
# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import votes [as 别名]
def get_all_tracks(self):
self.db.commit_statement('''select * from playlist_tracks where playlist_id = ? order by position''', [int(self.id)])
row = self.db.fetchone()
tracks = []
while row != None:
tracks.append((str(row['id']), row['track_id'], row['votes'])) # FIXME: broken!
row = self.db.fetchone()
ret_tracks = []
for track in tracks:
# TODO: replace with an SQL statement that instantly creates a Track object
self.db.commit_statement('''select * from tracks where id = ?''', [track[1]])
row = self.db.fetchone()
oldid = row['id']
del row['id']
t = Track(**row)
t.id = track[0]
t.votes = str(track[2])
t.voters = t.get_all_voting_users(oldid)
ret_tracks.append(t)
return ret_tracks