def __init__(self, station): name = station self._lastfmradio = lastfm.Radio() MusicList.__init__(self, name) self._tuned = False self._radiouri = station self._lastfmqueue = [] self._fill_lastfm_queue()
def getNextTrackIndex(self, index=None): assert len(self._lastfmqueue) > 0 #don't care for the current track, just get the next one track = self._lastfmqueue.pop(0) #TODO: Make sure that the given track is still valid # i.e. we are still allowed to download it, given its validty timestamp # -> speed boost #Make sure we add tracks to the last-fm queue in time if len(self._lastfmqueue) < 2: self._fill_lastfm_queue() #Play the new track: add it to the playlist track_id = MusicList.addTrack(self, track) #Bypass our own addTrack impl, use supers impl. instead! return track_id
def getNextTrackIndex(self, index=None): assert len(self._lastfmqueue) > 0 #don't care for the current track, just get the next one track = self._lastfmqueue.pop(0) #TODO: Make sure that the given track is still valid # i.e. we are still allowed to download it, given its validty timestamp # -> speed boost #Make sure we add tracks to the last-fm queue in time if len(self._lastfmqueue) < 2: self._fill_lastfm_queue() #Play the new track: add it to the playlist track_id = MusicList.addTrack( self, track) #Bypass our own addTrack impl, use supers impl. instead! return track_id
def getTrack(self, index): if index == 0 and self._tracks.length( ) == 0: #If no track has been loaded, bootstrap the list self.getNextTrackIndex() return MusicList.getTrack(self, index)
def getTrack(self, index): if index == 0 and self._tracks.length() == 0: #If no track has been loaded, bootstrap the list self.getNextTrackIndex() return MusicList.getTrack(self, index)