示例#1
0
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, 'echonest')
    coffeehouse = pbl.Sorter(coffeehouse, 'echonest.energy')
    coffeehouse = pbl.LongerThan(coffeehouse, 30 * 60)
    pbl.show_source(coffeehouse, props=['duration', 'echonest.energy'])
示例#2
0
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'])
示例#3
0
            else:
                return 'unknown type ' + comp['_type'] + ' for ' + objname, None
        else:
            return 'missing object ' + objname, None
    
def compile(program):
    if 'main' in program and program['main']:
        program['symbols'] = {}
        program['hsymbols'] = {}
        status, compiled_program = compile_object(program['main'], program)
        return status, compiled_program
    else:
        return 'no main', None


if __name__ == '__main__':
    import sys
    import json

    if len(sys.argv) > 1:
        path = sys.argv[1]
        source = open(path).read()
        source_obj = json.loads(source)

        status, obj = compile(source_obj)
        if status == OK:
            print 'compiled! = running'
            pbl.show_source(obj, props= ['src', 'duration'])
        else:
            print 'Whoops', status
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, "echonest")
    coffeehouse = pbl.Sorter(coffeehouse, "echonest.energy")
    coffeehouse = pbl.LongerThan(coffeehouse, 30 * 60)
    pbl.show_source(coffeehouse, props=["duration", "echonest.energy"])
示例#5
0
            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

示例#6
0
            else:
                return 'unknown type ' + comp['type'] + ' for ' + objname, None
        else:
            return 'missing object ' + str(objname), None
    
def compile(program):
    if 'main' in program and program['main']:
        program['symbols'] = {}
        program['hsymbols'] = {}
        status, compiled_program = compile_object(program['main'], program)
        return status, compiled_program
    else:
        return 'no main', None


if __name__ == '__main__':
    import sys
    import json

    if len(sys.argv) > 1:
        path = sys.argv[1]
        source = open(path).read()
        source_obj = json.loads(source)

        status, obj = compile(source_obj)
        if status == OK:
            print 'compiled! = running'
            pbl.show_source(obj, props= ['src', 'duration'])
        else:
            print 'Whoops', status
示例#7
0
        return -1




if __name__ == '__main__':


    import sys
    if False:
        p1 = pbl.ArtistTopTracks(name='Ravenscry')
        #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'
示例#8
0
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)
示例#9
0
        return cur_score, len(indexes)

    def create_buffer(self):
        self.buffer = []
        for ti in self.tracks:
            self.buffer.append(ti['id'])

    def next_track(self):
        while self.filling:
            track = self.source.next_track()
            if track:
                tinfo = pbl.tlib.get_track(track)
                self.tracks.append(tinfo)
            else:
                self.filling = False
                self.separate_artists()
                self.create_buffer()

        if len(self.buffer) > 0:
            return self.buffer.pop()
        else:
            return None


if __name__ == '__main__':
    import sys
    p1 = pbl.ArtistTopTracks(name='Ravenscry')
    p2 = pbl.ArtistTopTracks(name='weezer')
    mi = MixIn(p1, p2, 2, 1, 1, True)
    pbl.show_source(mi)
示例#10
0
                return "unknown type " + comp["type"] + " for " + objname, None
        else:
            return "missing object " + str(objname), None


def compile(program):
    if "main" in program and program["main"]:
        program["symbols"] = {}
        program["hsymbols"] = {}
        status, compiled_program = compile_object(program["main"], program)
        return status, compiled_program
    else:
        return "no main", None


if __name__ == "__main__":
    import sys
    import json

    if len(sys.argv) > 1:
        path = sys.argv[1]
        source = open(path).read()
        source_obj = json.loads(source)

        status, obj = compile(source_obj)
        if status == OK:
            print "compiled! = running"
            pbl.show_source(obj, props=["src", "duration"])
        else:
            print "Whoops", status
示例#11
0
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)
示例#12
0
        return -1




if __name__ == '__main__':


    import sys
    if False:
        p1 = pbl.ArtistTopTracks(name='Ravenscry')
        #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'
示例#13
0
                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