當前位置: 首頁>>代碼示例>>Python>>正文


Python Playlist.get方法代碼示例

本文整理匯總了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
開發者ID:estock,項目名稱:dogvibes,代碼行數:10,代碼來源:dogvibes.py

示例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()
開發者ID:estock,項目名稱:dogvibes,代碼行數:20,代碼來源:amp.py


注:本文中的models.Playlist.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。