示例#1
0
 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)
示例#2
0
文件: loaders.py 项目: prepux/spotimc
 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]
示例#3
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]