Example #1
0
    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
Example #2
0
 def testSix(self):
     self.assertEquals(pathscan.getPathArtist(
         u'/home/audio/bbq/A-Ha - Crying In The Rain'),
         u'A-Ha')
Example #3
0
 def testFive(self):
     self.assertEquals(pathscan.getPathArtist(
         u'/home/audio/bbq/04. Coldplay - Fix You.mp3'),
         u'Coldplay')
Example #4
0
 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')
Example #5
0
 def testThree(self):
     self.assertEquals(pathscan.getPathArtist(
         u'/home/audio/bbq/102_Justin_Timberlake_and_Timbaland_-_Sexyback-50K4.mp3'),
         u'Justin Timberlake and Timbaland')
Example #6
0
 def testTwo(self):
     self.assertEquals(pathscan.getPathArtist(
         u'/path/to/music/Afghan Whigs - Debonair.ogg'),
             'Afghan Whigs')
Example #7
0
 def testOne(self):
     self.assertEquals(pathscan.getPathArtist(
         u'/home/audio/bbq/Broken Social Scene - 13 - Pitter Patter Goes My Heart.mp3'),
         'Broken Social Scene')