Пример #1
0
    def get_drag_data(self, locs, compile_tracks=True, existing_tracks=[]):
        """
            Handles the locations from drag data

            @param locs: locations we are dealing with (can
                be anything from a file to a folder)
            @param compile_tracks: if true any tracks in the playlists
                that are not found as tracks are added to the list of tracks
            @param existing_tracks: a list of tracks that have already
                been loaded from files (used to skip loading the dragged
                tracks from the filesystem)

            @returns: a 2 tuple in which the first part is a list of tracks
                and the second is a list of playlist (note: any files that are
                in a playlist are not added to the list of tracks, but a track could
                be both in as a found track and part of a playlist)
        """
        # TODO handle if they pass in existing tracks
        trs = []
        playlists = []
        for loc in locs:
            (found_tracks, found_playlist) = self._handle_unknown_drag_data(loc)
            trs.extend(found_tracks)
            playlists.extend(found_playlist)

        if compile_tracks:
            # Add any tracks in the playlist to the master list of tracks
            for playlist in playlists:
                for track in playlist.get_tracks():
                    if track not in trs:
                        trs.append(track)

        return (trs, playlists)
Пример #2
0
    def get_rest_sids(self, playlist):
        playlist = self.get_current_playlist()

        current_tracks = playlist.get_tracks()
        rest_tracks = current_tracks[playlist.get_current_pos() + 1:]
        rest_sids = self.tracks_to_sids(rest_tracks)
        return rest_sids
Пример #3
0
    def get_drag_data(self, locs, compile_tracks=True, existing_tracks=[]):
        """
            Handles the locations from drag data

            @param locs: locations we are dealing with (can
                be anything from a file to a folder)
            @param compile_tracks: if true any tracks in the playlists
                that are not found as tracks are added to the list of tracks
            @param existing_tracks: a list of tracks that have already
                been loaded from files (used to skip loading the dragged
                tracks from the filesystem)

            @returns: a 2 tuple in which the first part is a list of tracks
                and the second is a list of playlist (note: any files that are
                in a playlist are not added to the list of tracks, but a track could
                be both in as a found track and part of a playlist)
        """
        #TODO handle if they pass in existing tracks
        trs = []
        playlists = []
        for loc in locs:
            (found_tracks,
             found_playlist) = self._handle_unknown_drag_data(loc)
            trs.extend(found_tracks)
            playlists.extend(found_playlist)

        if compile_tracks:
            #Add any tracks in the playlist to the master list of tracks
            for playlist in playlists:
                for track in playlist.get_tracks():
                    if track not in trs:
                        trs.append(track)

        return (trs, playlists)
Пример #4
0
    def get_rest_sids(self, playlist):
        playlist = self.get_current_playlist()

        current_tracks = playlist.get_tracks()
        rest_tracks = current_tracks[playlist.get_current_pos()+1:]
        rest_sids = self.tracks_to_sids(rest_tracks)
        return rest_sids
Пример #5
0
 def check_to_load_more(self, type, player, track):
     playlist = self.get_current_playlist()
     if isinstance(playlist, DoubanFMPlaylist):
         ## check if last one
         if playlist.index(track) == len(playlist.get_tracks()) - 1:
             self.load_more(playlist)
Пример #6
0
 def check_to_load_more(self, type, player, track):
     playlist = self.get_current_playlist()
     if isinstance(playlist, DoubanFMPlaylist):
         ## check if last one
         if playlist.index(track) == len(playlist.get_tracks())-1:
             self.load_more(playlist)