本文整理匯總了Python中models.Playlist.get方法的典型用法代碼示例。如果您正苦於以下問題:Python Playlist.get方法的具體用法?Python Playlist.get怎麽用?Python Playlist.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models.Playlist
的用法示例。
在下文中一共展示了Playlist.get方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_all_tracks_in_playlist
# 需要導入模塊: from models import Playlist [as 別名]
# 或者: from models.Playlist import get [as 別名]
def get_all_tracks_in_playlist(self, playlist_id):
try:
playlist = Playlist.get(playlist_id)
except ValueError as e:
raise
tracks = playlist.get_all_tracks()
ret = [track.__dict__ for track in tracks]
return ret
示例2: API_removeTracks
# 需要導入模塊: from models import Playlist [as 別名]
# 或者: from models.Playlist import get [as 別名]
def API_removeTracks(self, track_ids, request):
for track_id in track_ids.split(','):
# don't crash on trailing comma
if track_id != '':
track_id = int(track_id)
# For now if we are trying to remove the existing playing track. Do nothing.
if (track_id == self.active_playlist_id):
logging.warning("Not allowed to remove playing track")
continue
playlist = Playlist.get(self.tmpqueue_id)
playlist.remove_playlist_tracks_id(track_id)
self.needs_push_update = True
self.playlist_version += 1
self.vote_version += 1
request.push({'vote_version': self.vote_version})
request.finish()