本文整理汇总了Python中models.Entry.insert_at方法的典型用法代码示例。如果您正苦于以下问题:Python Entry.insert_at方法的具体用法?Python Entry.insert_at怎么用?Python Entry.insert_at使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Entry
的用法示例。
在下文中一共展示了Entry.insert_at方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: API_queueAndPlay
# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import insert_at [as 别名]
def API_queueAndPlay(self, uri, request):
# If in tmpqueue and state is playing and there are tracks in tmpqueue.
# Then remove the currently playing track. Since we do not want to queue tracks
# from just "clicking around".
playlist = Playlist.objects.get(id=self.active_playlist_id)
if self.is_in_tmpqueue() and self.get_state() == 'playing' and playlist.tracks.count() >= 1:
playlist.entry_set.all()[0].delete()
tracks = self.dogvibes.create_tracks_from_uri(uri)
e = None
queue = Playlist.objects.get(id=self.tmpqueue_id)
for track in tracks:
e = Entry(playlist=queue, track=track)
e.insert_at(0)
self.play_track(queue.id, e.id)
self.playlist_version += 1
self.needs_push_update = True
request.finish()