def partial_result(self, playlist, page, session):
     tracks = []
     page = Page(page.start, page.offset, playlist.num_tracks(), page.identifier)
     
     for i in page.current_range():
         track = playlist.track(i)
         tracks.append(track)
         
     return Model(tracks = self.model_factory.to_track_list_model(tracks, session), page = page)
Example #2
0
 def get_tracks(self):
     playlist = self.get_playlist()
     def sort_func(track_index):
         track = playlist.track(track_index)
         if track.is_loaded():
             return -playlist.track_create_time(track_index)
     
     track_indexes = range(playlist.num_tracks() - 1)
     sorted_indexes = sorted(track_indexes, key=sort_func)
     
     return [playlist.track(index) for index in sorted_indexes]