def songs_that_match(self,string): '''List of Songs with string in their song name''' songs = [] for i in range(xmms.get_playlist_length()): if string.lower() in xmms.get_playlist_title(i).lower(): songs.append(i) return songs
def playlist_clear_down(atlast=500,session=0): ''' clear playlist starting from current position + atlast doen. "atlast" numer of song are retained for future play ''' try: play_ifnot(session=session) #force to play # take the current position (if error set pos=0) pos=get_playlist_securepos(session) if pos is None: return False length=xmms.get_playlist_length(session) #elimino il troppo if length-pos > atlast : for prm in xrange(length,pos+atlast,-1): xmms.control.playlist_delete(prm,session) return True except: return False
def songs_that_match(self,string): '''This Returns a List of Songs that Match a Pattern''' songs = [] for i in range(xmms.get_playlist_length()): if string.lower() in xmms.get_playlist_title(i).lower(): songs.append(i) return songs
def getxmmsinfo(self): while self.listView.lastItem(): self.listView.takeItem(self.listView.lastItem()) self.xmms_playlist = [] cur_pos = xmms.get_playlist_pos() for i in range(xmms.get_playlist_length()): item = QListViewItem(self.listView) item.playlist_pos = i item.title = xmms.get_playlist_title(i) item.dur = int(xmms.get_playlist_time(i)) item.file = xmms.get_playlist_file(i) self.xmms_playlist.append(item) dur_s = str(item.dur / 60000) + ":" + ("0" + str( (item.dur / 1000) % 60))[-2:] pp = str(i + 1) item.setText(0, " " * (5 - len(pp)) + pp) item.setText(1, item.title) item.setText(2, dur_s) if cur_pos == i: self.listView.setSelected(item, True)