def shuffle(self, paths): result = [] artists = {} # FIXME: reuse selectables logic for path in paths: artist = pathscan.getPathArtist(path) if not artist in artists.keys(): artists[artist] = [] artists[artist].append(path) paths = [] for artist, p in artists.items(): paths.append(random.choice(p)) res = paths[:] if self._random: random.shuffle(res) return res
def testSix(self): self.assertEquals(pathscan.getPathArtist( u'/home/audio/bbq/A-Ha - Crying In The Rain'), u'A-Ha')
def testFive(self): self.assertEquals(pathscan.getPathArtist( u'/home/audio/bbq/04. Coldplay - Fix You.mp3'), u'Coldplay')
def testFour(self): self.assertEquals(pathscan.getPathArtist( u'05 - Clap Your Hands Say Yeah - Details Of The War.mp3'), u'Clap Your Hands Say Yeah')
def testThree(self): self.assertEquals(pathscan.getPathArtist( u'/home/audio/bbq/102_Justin_Timberlake_and_Timbaland_-_Sexyback-50K4.mp3'), u'Justin Timberlake and Timbaland')
def testTwo(self): self.assertEquals(pathscan.getPathArtist( u'/path/to/music/Afghan Whigs - Debonair.ogg'), 'Afghan Whigs')
def testOne(self): self.assertEquals(pathscan.getPathArtist( u'/home/audio/bbq/Broken Social Scene - 13 - Pitter Patter Goes My Heart.mp3'), 'Broken Social Scene')