示例#1
0
 def search(self, page = {}):
     page = Page.from_obj(page)
     session = self.current_session()
     search_result = Search(page, session).run_and_wait()
     tracks = LoadTrack.from_list(search_result.tracks(), session)
     
     return Model(tracks = self.model_factory.to_track_list_model(tracks, session), page = page)
示例#2
0
 def album_tracks(self, album_uri):
     session = self.current_session()
     album = LoadAlbum.from_uri(album_uri, session)
     browse = BrowseAlbum(album, session).run_and_wait()
     tracks = LoadTrack.from_list(browse.tracks(), session)
 
     return self.model_factory.to_track_list_model(tracks, session)
示例#3
0
 def tracks_model(self, playlist, page, session):
     if not page.is_infinite():
         tracks_model = self.partial_result(playlist, page, session)
     else:            
         tracks = LoadTrack.from_list(playlist.tracks(), session)
         tracks_model = Model(tracks = self.model_factory.to_track_list_model(tracks, session), page = Page())
      
     return tracks_model