def test_artist_separation(self): src = pbl.PlaylistSource("extender test", None, 'plamere') runner(src, 500) src = pbl.PlaylistSource("extender test", None, 'plamere') asep = ArtistSeparation(src, 4, True) runner(asep, 500)
def test_artist_dedup(self): print 'with dedup' src = pbl.PlaylistSource("extender test", None, 'plamere') src = ArtistDeDup(src) de_dup_size = runner(src, 500) src = pbl.PlaylistSource("extender test", None, 'plamere') undup_size = runner(src, 500) assert de_dup_size < undup_size
import pbl ''' 30 minutes of the lowest energy tracks from your favorite coffeehouse ''' if __name__ == '__main__': coffeehouse = pbl.PlaylistSource('Your Favorite Coffeehouse') coffeehouse = pbl.Annotator(coffeehouse, 'audio') coffeehouse = pbl.Sorter(coffeehouse, 'audio.energy') coffeehouse = pbl.LongerThan(coffeehouse, 30 * 60) pbl.show_source(coffeehouse, props=['duration', 'spotify', 'audio.energy'])
if self.bad_track_source: while True: bad_track = self.bad_track_source.next_track() if bad_track: self.bad_tracks.add(bad_track) else: break self.artist_history = [] self.track_history = set() if __name__ == '__main__': import sys # first test p1 = pbl.ArtistTopTracks(name='Ravenscry') p2 = pbl.ArtistTopTracks(name='weezer') p2 = pbl.ArtistTopTracks(name='weezer') p3 = pbl.PlaylistSource(name='RapCaviar') mi = Mixer([p1, p2, p3], None, None, True, 5, False, 50) pbl.show_source(mi) p1 = pbl.PlaylistSource(name='RapCaviar') p2 = pbl.PlaylistSource(name='Rise & Shine') p3 = pbl.PlaylistSource(name='extender test', uri='spotify:user:plamere:playlist:7pcDE4xQBZtz3brznnEN8L') p4 = pbl.AlbumSource('Tarkus', 'Emerson, Lake & Palmer') p5 = pbl.AlbumSource('Brain Salad Surgery', 'Emerson, Lake & Palmer') skip = pbl.AlbumSource('Brain Salad Surgery', 'Emerson, Lake & Palmer') mi = Mixer([p1, p2, p3, p4, p5], [skip], [], True, 2, False, 100) pbl.show_source(mi, props=['source']) # second test
import pbl ''' alternate tracks between two different playlists ''' if __name__ == '__main__': coffeehouse = pbl.PlaylistSource('Your Favorite Coffeehouse') teen_party = pbl.PlaylistSource('Teen Party') both = pbl.Alternate([coffeehouse, teen_party]) pbl.show_source(both, ntracks=10)
#p2 = pbl.ArtistTopTracks(name='weezer') #mi = MixIn(p1, p2, 2,1,1, True) #pbl.show_source(mi) save = PlaylistSaveToNew(p1, 'test', 'day-of-month') pbl.show_source(save) if False: dec1 = date_to_epoch("2015-12-01") src = DatedPlaylistSource("extender test", None, 'plamere', order_by_date_added=False, tracks_added_since=-1, tracks_added_before=dec1) pbl.show_source(src) if False: print 'with dedup' src = pbl.PlaylistSource("extender test", None, 'plamere') src = ArtistDeDup(src) pbl.show_source(src) print 'no dedup' src = pbl.PlaylistSource("extender test", None, 'plamere') pbl.show_source(src) if False: print 'weighted source' print 'factor', 1 src = pbl.PlaylistSource("extender test", None, 'plamere') src = WeightedShuffler(src, 1) pbl.show_source(src)