本文整理汇总了Python中track.Track.id方法的典型用法代码示例。如果您正苦于以下问题:Python Track.id方法的具体用法?Python Track.id怎么用?Python Track.id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类track.Track
的用法示例。
在下文中一共展示了Track.id方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_track_row
# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import id [as 别名]
def get_track_row(self):
row = self.db.fetchone()
tid = row['track_id']
position = row['position']
ptid = row['id']
self.db.commit_statement('''select * from tracks where id = ?''', [row['track_id']])
row = self.db.fetchone()
del row['id']
t = Track(**row)
t.id = tid
t.position = position
t.ptid = ptid
return t
示例2: get_track_row
# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import id [as 别名]
def get_track_row(self):
row = self.db.fetchone()
tid = row["track_id"]
position = row["position"]
ptid = row["id"]
self.db.commit_statement("""select * from tracks where id = ?""", [row["track_id"]])
row = self.db.fetchone()
del row["id"]
t = Track(**row)
t.id = tid
t.position = position
t.ptid = ptid
return t
示例3: _get_tracks_list
# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import id [as 别名]
def _get_tracks_list(self, query):
self._cur.execute(query)
rows = self._cur.fetchall()
result = []
for row in rows:
t = Track()
t.id = row["id"]
t.subfile_no = row["subfile_no"]
t.title = row["title"]
t.offset = row["offset"]
t.size = row["size"]
t.filehash = row["filehash"]
t.created_at = row["created_at"]
result.append(t)
return result;
示例4: get_all_tracks
# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import id [as 别名]
def get_all_tracks(self):
self.db.commit_statement('''select * from playlist_tracks where playlist_id = ?''', [int(self.id)])
row = self.db.fetchone()
tracks = []
while row != None:
tracks.append((str(row['id']), row['track_id'])) # 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()
del row['id']
t = Track(**row)
t.id = track[0] # add the playlist-to-track id instead
ret_tracks.append(t)
return ret_tracks
示例5: get_track_nbr
# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import id [as 别名]
def get_track_nbr(self, nbr):
self.db.commit_statement('''select * from playlist_tracks where playlist_id = ?''', [int(self.id)])
row = self.db.fetchone()
# There is probably a much smarter way to fetch a specific row number
i = 0
while i < nbr:
row = self.db.fetchone()
i = i + 1
tid = row['id']
self.db.commit_statement('''select * from tracks where id = ?''', [row['track_id']])
row = self.db.fetchone()
del row['id']
t = Track(**row)
t.id = tid
return t
示例6: get_all_tracks
# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import id [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"])) # 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()
del row["id"]
t = Track(**row)
t.id = track[0]
ret_tracks.append(t)
return ret_tracks
示例7: get_all_tracks
# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import id [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